From bd866aca455f0e427b2a2b9cf8a39a38c2329a4b Mon Sep 17 00:00:00 2001 From: Yussuf Shaikh Date: Mon, 3 Jan 2022 13:17:34 +0530 Subject: [PATCH] Updated stub with service-broker v1.85.0-ibm using the latest go-swagger client Signed-off-by: Yussuf Shaikh --- .gitignore | 1 + clients/instance/ibm-pi-dhcp.go | 8 +- clients/instance/ibm-pi-instance.go | 34 +- clients/instance/ibm-pi-sap-instance.go | 6 +- clients/instance/ibm-pi-snapshot.go | 2 +- clients/instance/ibm-pi-vpn-policy.go | 20 +- clients/instance/ibm-pi-vpn.go | 24 +- examples/instance/main.go | 4 +- examples/vpn/main.go | 10 +- ibmpisession/ibmpowersession.go | 2 +- .../authentication/authentication_client.go | 275 ++++-- ...service_broker_auth_callback_parameters.go | 45 +- .../service_broker_auth_callback_responses.go | 26 +- ...broker_auth_device_code_post_parameters.go | 45 +- ..._broker_auth_device_code_post_responses.go | 26 +- ...roker_auth_device_token_post_parameters.go | 50 +- ...broker_auth_device_token_post_responses.go | 44 +- ...rvice_broker_auth_info_token_parameters.go | 45 +- ...ervice_broker_auth_info_token_responses.go | 20 +- ...ervice_broker_auth_info_user_parameters.go | 45 +- ...service_broker_auth_info_user_responses.go | 20 +- .../service_broker_auth_login_parameters.go | 93 +- .../service_broker_auth_login_responses.go | 26 +- .../service_broker_auth_logout_parameters.go | 45 +- .../service_broker_auth_logout_responses.go | 20 +- ...r_auth_registration_callback_parameters.go | 45 +- ...er_auth_registration_callback_responses.go | 26 +- ...ice_broker_auth_registration_parameters.go | 111 ++- ...vice_broker_auth_registration_responses.go | 26 +- ...rvice_broker_auth_token_post_parameters.go | 52 +- ...ervice_broker_auth_token_post_responses.go | 38 +- ...bluemix_service_instance_get_parameters.go | 49 +- .../bluemix_service_instance_get_responses.go | 20 +- ...bluemix_service_instance_put_parameters.go | 57 +- .../bluemix_service_instance_put_responses.go | 20 +- .../bluemix_service_instances_client.go | 67 +- power/client/catalog/catalog_client.go | 41 +- .../client/catalog/catalog_get_parameters.go | 49 +- power/client/catalog/catalog_get_responses.go | 14 +- .../hardware_platforms_client.go | 41 +- ...broker_hardwareplatforms_get_parameters.go | 52 +- ..._broker_hardwareplatforms_get_responses.go | 20 +- .../iaas_service_broker_client.go | 119 ++- .../service_broker_health_head_parameters.go | 45 +- .../service_broker_health_head_responses.go | 20 +- .../service_broker_health_parameters.go | 45 +- .../service_broker_health_responses.go | 20 +- .../service_broker_test_timeout_parameters.go | 50 +- .../service_broker_test_timeout_responses.go | 14 +- .../service_broker_version_parameters.go | 45 +- .../service_broker_version_responses.go | 20 +- .../internal_storage_regions_client.go | 145 ++- ...ge_regions_storage_pools_get_parameters.go | 54 +- ...age_regions_storage_pools_get_responses.go | 32 +- ...regions_storage_pools_getall_parameters.go | 49 +- ..._regions_storage_pools_getall_responses.go | 32 +- ...ge_regions_storage_pools_put_parameters.go | 62 +- ...age_regions_storage_pools_put_responses.go | 38 +- ...orage_regions_thresholds_get_parameters.go | 49 +- ...torage_regions_thresholds_get_responses.go | 32 +- ...orage_regions_thresholds_put_parameters.go | 57 +- ...torage_regions_thresholds_put_responses.go | 50 +- .../client/open_stacks/open_stacks_client.go | 140 ++- ...ervice_broker_openstacks_get_parameters.go | 45 +- ...service_broker_openstacks_get_responses.go | 32 +- ..._broker_openstacks_hosts_get_parameters.go | 54 +- ...e_broker_openstacks_hosts_get_responses.go | 32 +- ...ker_openstacks_openstack_get_parameters.go | 49 +- ...oker_openstacks_openstack_get_responses.go | 32 +- ...rvice_broker_openstacks_post_parameters.go | 52 +- ...ervice_broker_openstacks_post_responses.go | 44 +- ...roker_openstacks_servers_get_parameters.go | 54 +- ...broker_openstacks_servers_get_responses.go | 32 +- .../p_cloud_cloud_connections_client.go | 198 ++-- ...loud_cloudconnections_delete_parameters.go | 54 +- ...cloud_cloudconnections_delete_responses.go | 44 +- .../pcloud_cloudconnections_get_parameters.go | 54 +- .../pcloud_cloudconnections_get_responses.go | 38 +- ...loud_cloudconnections_getall_parameters.go | 49 +- ...cloud_cloudconnections_getall_responses.go | 38 +- ...dconnections_networks_delete_parameters.go | 59 +- ...udconnections_networks_delete_responses.go | 44 +- ...loudconnections_networks_put_parameters.go | 59 +- ...cloudconnections_networks_put_responses.go | 44 +- ...pcloud_cloudconnections_post_parameters.go | 57 +- .../pcloud_cloudconnections_post_responses.go | 56 +- .../pcloud_cloudconnections_put_parameters.go | 62 +- .../pcloud_cloudconnections_put_responses.go | 62 +- ..._virtualprivateclouds_getall_parameters.go | 49 +- ...s_virtualprivateclouds_getall_responses.go | 32 +- .../p_cloud_events/p_cloud_events_client.go | 67 +- .../pcloud_events_get_parameters.go | 60 +- .../pcloud_events_get_responses.go | 38 +- .../pcloud_events_getquery_parameters.go | 79 +- .../pcloud_events_getquery_responses.go | 32 +- .../p_cloud_images/p_cloud_images_client.go | 348 +++++-- ...cloudinstances_images_delete_parameters.go | 54 +- ..._cloudinstances_images_delete_responses.go | 38 +- ...instances_images_export_post_parameters.go | 62 +- ...dinstances_images_export_post_responses.go | 44 +- ...ud_cloudinstances_images_get_parameters.go | 54 +- ...oud_cloudinstances_images_get_responses.go | 38 +- ...cloudinstances_images_getall_parameters.go | 49 +- ..._cloudinstances_images_getall_responses.go | 38 +- ...d_cloudinstances_images_post_parameters.go | 57 +- ...ud_cloudinstances_images_post_responses.go | 50 +- ...oudinstances_stockimages_get_parameters.go | 54 +- ...loudinstances_stockimages_get_responses.go | 38 +- ...instances_stockimages_getall_parameters.go | 65 +- ...dinstances_stockimages_getall_responses.go | 38 +- .../pcloud_images_get_parameters.go | 49 +- .../pcloud_images_get_responses.go | 38 +- .../pcloud_images_getall_parameters.go | 60 +- .../pcloud_images_getall_responses.go | 38 +- ...cloudinstances_cosimages_get_parameters.go | 49 +- ..._cloudinstances_cosimages_get_responses.go | 32 +- ...loudinstances_cosimages_post_parameters.go | 57 +- ...cloudinstances_cosimages_post_responses.go | 50 +- .../pcloud_v2_images_export_get_parameters.go | 54 +- .../pcloud_v2_images_export_get_responses.go | 32 +- ...pcloud_v2_images_export_post_parameters.go | 62 +- .../pcloud_v2_images_export_post_responses.go | 50 +- .../p_cloud_instances_client.go | 93 +- ...pcloud_cloudinstances_delete_parameters.go | 49 +- .../pcloud_cloudinstances_delete_responses.go | 38 +- .../pcloud_cloudinstances_get_parameters.go | 49 +- .../pcloud_cloudinstances_get_responses.go | 38 +- .../pcloud_cloudinstances_put_parameters.go | 57 +- .../pcloud_cloudinstances_put_responses.go | 38 +- .../p_cloud_jobs/p_cloud_jobs_client.go | 93 +- ...d_cloudinstances_jobs_delete_parameters.go | 54 +- ...ud_cloudinstances_jobs_delete_responses.go | 44 +- ...loud_cloudinstances_jobs_get_parameters.go | 54 +- ...cloud_cloudinstances_jobs_get_responses.go | 38 +- ...d_cloudinstances_jobs_getall_parameters.go | 73 +- ...ud_cloudinstances_jobs_getall_responses.go | 38 +- .../p_cloud_networks_client.go | 270 ++++-- .../pcloud_networks_delete_parameters.go | 54 +- .../pcloud_networks_delete_responses.go | 38 +- .../pcloud_networks_get_parameters.go | 54 +- .../pcloud_networks_get_responses.go | 38 +- .../pcloud_networks_getall_parameters.go | 57 +- .../pcloud_networks_getall_responses.go | 32 +- ...pcloud_networks_ports_delete_parameters.go | 59 +- .../pcloud_networks_ports_delete_responses.go | 38 +- .../pcloud_networks_ports_get_parameters.go | 59 +- .../pcloud_networks_ports_get_responses.go | 32 +- ...pcloud_networks_ports_getall_parameters.go | 54 +- .../pcloud_networks_ports_getall_responses.go | 32 +- .../pcloud_networks_ports_post_parameters.go | 62 +- .../pcloud_networks_ports_post_responses.go | 44 +- .../pcloud_networks_ports_put_parameters.go | 67 +- .../pcloud_networks_ports_put_responses.go | 38 +- .../pcloud_networks_post_parameters.go | 57 +- .../pcloud_networks_post_responses.go | 50 +- .../pcloud_networks_put_parameters.go | 62 +- .../pcloud_networks_put_responses.go | 38 +- .../p_cloud_p_vm_instances_client.go | 653 ------------- .../p_cloudp_vm_instances_client.go | 904 ++++++++++++++++++ ...oud_pvminstances_action_post_parameters.go | 62 +- ...loud_pvminstances_action_post_responses.go | 38 +- ...ud_pvminstances_capture_post_parameters.go | 62 +- ...oud_pvminstances_capture_post_responses.go | 44 +- ...loud_pvminstances_clone_post_parameters.go | 62 +- ...cloud_pvminstances_clone_post_responses.go | 44 +- ...oud_pvminstances_console_get_parameters.go | 54 +- ...loud_pvminstances_console_get_responses.go | 32 +- ...ud_pvminstances_console_post_parameters.go | 54 +- ...oud_pvminstances_console_post_responses.go | 32 +- ...oud_pvminstances_console_put_parameters.go | 62 +- ...loud_pvminstances_console_put_responses.go | 32 +- .../pcloud_pvminstances_delete_parameters.go | 62 +- .../pcloud_pvminstances_delete_responses.go | 44 +- .../pcloud_pvminstances_get_parameters.go | 54 +- .../pcloud_pvminstances_get_responses.go | 38 +- .../pcloud_pvminstances_getall_parameters.go | 49 +- .../pcloud_pvminstances_getall_responses.go | 32 +- ...pvminstances_networks_delete_parameters.go | 67 +- ..._pvminstances_networks_delete_responses.go | 38 +- ...ud_pvminstances_networks_get_parameters.go | 59 +- ...oud_pvminstances_networks_get_responses.go | 32 +- ...pvminstances_networks_getall_parameters.go | 54 +- ..._pvminstances_networks_getall_responses.go | 32 +- ...d_pvminstances_networks_post_parameters.go | 62 +- ...ud_pvminstances_networks_post_responses.go | 44 +- ...pvminstances_operations_post_parameters.go | 62 +- ..._pvminstances_operations_post_responses.go | 44 +- .../pcloud_pvminstances_post_parameters.go | 65 +- .../pcloud_pvminstances_post_responses.go | 62 +- .../pcloud_pvminstances_put_parameters.go | 62 +- .../pcloud_pvminstances_put_responses.go | 38 +- ...vminstances_snapshots_getall_parameters.go | 54 +- ...pvminstances_snapshots_getall_responses.go | 38 +- ..._pvminstances_snapshots_post_parameters.go | 62 +- ...d_pvminstances_snapshots_post_responses.go | 44 +- ...ances_snapshots_restore_post_parameters.go | 75 +- ...tances_snapshots_restore_post_responses.go | 38 +- ..._v2_pvminstances_capture_get_parameters.go | 54 +- ...d_v2_pvminstances_capture_get_responses.go | 32 +- ...v2_pvminstances_capture_post_parameters.go | 62 +- ..._v2_pvminstances_capture_post_responses.go | 50 +- .../p_cloud_placement_groups_client.go | 171 +++- ...cloud_placementgroups_delete_parameters.go | 54 +- ...pcloud_placementgroups_delete_responses.go | 32 +- .../pcloud_placementgroups_get_parameters.go | 54 +- .../pcloud_placementgroups_get_responses.go | 32 +- ...cloud_placementgroups_getall_parameters.go | 49 +- ...pcloud_placementgroups_getall_responses.go | 32 +- ...acementgroups_members_delete_parameters.go | 62 +- ...lacementgroups_members_delete_responses.go | 76 +- ...placementgroups_members_post_parameters.go | 62 +- ..._placementgroups_members_post_responses.go | 76 +- .../pcloud_placementgroups_post_parameters.go | 57 +- .../pcloud_placementgroups_post_responses.go | 38 +- ...d_s_a_p_client.go => p_cloudsap_client.go} | 88 +- .../pcloud_sap_get_parameters.go | 54 +- .../p_cloud_s_a_p/pcloud_sap_get_responses.go | 38 +- .../pcloud_sap_getall_parameters.go | 49 +- .../pcloud_sap_getall_responses.go | 32 +- .../pcloud_sap_post_parameters.go | 57 +- .../pcloud_sap_post_responses.go | 56 +- .../p_cloud_service_d_h_c_p_client.go | 146 --- .../p_cloud_servicedhcp_client.go | 203 ++++ .../pcloud_dhcp_delete_parameters.go | 54 +- .../pcloud_dhcp_delete_responses.go | 38 +- .../pcloud_dhcp_get_parameters.go | 54 +- .../pcloud_dhcp_get_responses.go | 38 +- .../pcloud_dhcp_getall_parameters.go | 49 +- .../pcloud_dhcp_getall_responses.go | 26 +- .../pcloud_dhcp_post_parameters.go | 49 +- .../pcloud_dhcp_post_responses.go | 32 +- .../p_cloud_snapshots_client.go | 119 ++- ...udinstances_snapshots_delete_parameters.go | 54 +- ...oudinstances_snapshots_delete_responses.go | 44 +- ...cloudinstances_snapshots_get_parameters.go | 54 +- ..._cloudinstances_snapshots_get_responses.go | 38 +- ...udinstances_snapshots_getall_parameters.go | 49 +- ...oudinstances_snapshots_getall_responses.go | 32 +- ...cloudinstances_snapshots_put_parameters.go | 62 +- ..._cloudinstances_snapshots_put_responses.go | 38 +- .../p_cloud_storage_capacity_client.go | 119 ++- ...ud_storagecapacity_pools_get_parameters.go | 54 +- ...oud_storagecapacity_pools_get_responses.go | 32 +- ...storagecapacity_pools_getall_parameters.go | 49 +- ..._storagecapacity_pools_getall_responses.go | 26 +- ...ud_storagecapacity_types_get_parameters.go | 54 +- ...oud_storagecapacity_types_get_responses.go | 32 +- ...storagecapacity_types_getall_parameters.go | 49 +- ..._storagecapacity_types_getall_responses.go | 26 +- .../p_cloud_system_pools_client.go | 41 +- .../pcloud_systempools_get_parameters.go | 49 +- .../pcloud_systempools_get_responses.go | 26 +- .../p_cloud_tasks/p_cloud_tasks_client.go | 67 +- .../pcloud_tasks_delete_parameters.go | 49 +- .../pcloud_tasks_delete_responses.go | 44 +- .../pcloud_tasks_get_parameters.go | 49 +- .../pcloud_tasks_get_responses.go | 38 +- .../p_cloud_tenants/p_cloud_tenants_client.go | 67 +- .../pcloud_tenants_get_parameters.go | 49 +- .../pcloud_tenants_get_responses.go | 44 +- .../pcloud_tenants_put_parameters.go | 57 +- .../pcloud_tenants_put_responses.go | 38 +- .../p_cloud_tenants_ssh_keys_client.go | 140 ++- ...cloud_tenants_sshkeys_delete_parameters.go | 54 +- ...pcloud_tenants_sshkeys_delete_responses.go | 38 +- .../pcloud_tenants_sshkeys_get_parameters.go | 54 +- .../pcloud_tenants_sshkeys_get_responses.go | 38 +- ...cloud_tenants_sshkeys_getall_parameters.go | 49 +- ...pcloud_tenants_sshkeys_getall_responses.go | 38 +- .../pcloud_tenants_sshkeys_post_parameters.go | 57 +- .../pcloud_tenants_sshkeys_post_responses.go | 50 +- .../pcloud_tenants_sshkeys_put_parameters.go | 62 +- .../pcloud_tenants_sshkeys_put_responses.go | 38 +- .../p_cloud_v_p_n_connections_client.go | 371 ------- .../p_cloudvpn_connections_client.go | 512 ++++++++++ ...pcloud_vpnconnections_delete_parameters.go | 54 +- .../pcloud_vpnconnections_delete_responses.go | 44 +- .../pcloud_vpnconnections_get_parameters.go | 54 +- .../pcloud_vpnconnections_get_responses.go | 50 +- ...pcloud_vpnconnections_getall_parameters.go | 49 +- .../pcloud_vpnconnections_getall_responses.go | 44 +- ...nconnections_networks_delete_parameters.go | 62 +- ...pnconnections_networks_delete_responses.go | 50 +- ..._vpnconnections_networks_get_parameters.go | 54 +- ...d_vpnconnections_networks_get_responses.go | 48 +- ..._vpnconnections_networks_put_parameters.go | 62 +- ...d_vpnconnections_networks_put_responses.go | 50 +- ...nnections_peersubnets_delete_parameters.go | 62 +- ...onnections_peersubnets_delete_responses.go | 44 +- ...nconnections_peersubnets_get_parameters.go | 54 +- ...pnconnections_peersubnets_get_responses.go | 44 +- ...nconnections_peersubnets_put_parameters.go | 62 +- ...pnconnections_peersubnets_put_responses.go | 44 +- .../pcloud_vpnconnections_post_parameters.go | 57 +- .../pcloud_vpnconnections_post_responses.go | 50 +- .../pcloud_vpnconnections_put_parameters.go | 62 +- .../pcloud_vpnconnections_put_responses.go | 50 +- .../p_cloud_v_p_n_policies_client.go | 340 ------- .../p_cloudvpn_policies_client.go | 469 +++++++++ .../pcloud_ikepolicies_delete_parameters.go | 54 +- .../pcloud_ikepolicies_delete_responses.go | 38 +- .../pcloud_ikepolicies_get_parameters.go | 54 +- .../pcloud_ikepolicies_get_responses.go | 44 +- .../pcloud_ikepolicies_getall_parameters.go | 49 +- .../pcloud_ikepolicies_getall_responses.go | 44 +- .../pcloud_ikepolicies_post_parameters.go | 57 +- .../pcloud_ikepolicies_post_responses.go | 50 +- .../pcloud_ikepolicies_put_parameters.go | 62 +- .../pcloud_ikepolicies_put_responses.go | 44 +- .../pcloud_ipsecpolicies_delete_parameters.go | 54 +- .../pcloud_ipsecpolicies_delete_responses.go | 38 +- .../pcloud_ipsecpolicies_get_parameters.go | 54 +- .../pcloud_ipsecpolicies_get_responses.go | 44 +- .../pcloud_ipsecpolicies_getall_parameters.go | 49 +- .../pcloud_ipsecpolicies_getall_responses.go | 44 +- .../pcloud_ipsecpolicies_post_parameters.go | 57 +- .../pcloud_ipsecpolicies_post_responses.go | 50 +- .../pcloud_ipsecpolicies_put_parameters.go | 62 +- .../pcloud_ipsecpolicies_put_responses.go | 50 +- .../p_cloud_volumes/p_cloud_volumes_client.go | 639 +++++++++---- ...nstances_volumes_action_post_parameters.go | 62 +- ...instances_volumes_action_post_responses.go | 38 +- ...loudinstances_volumes_delete_parameters.go | 54 +- ...cloudinstances_volumes_delete_responses.go | 38 +- ...d_cloudinstances_volumes_get_parameters.go | 54 +- ...ud_cloudinstances_volumes_get_responses.go | 38 +- ...loudinstances_volumes_getall_parameters.go | 92 +- ...cloudinstances_volumes_getall_responses.go | 38 +- ..._cloudinstances_volumes_post_parameters.go | 57 +- ...d_cloudinstances_volumes_post_responses.go | 44 +- ...d_cloudinstances_volumes_put_parameters.go | 62 +- ...ud_cloudinstances_volumes_put_responses.go | 44 +- ..._pvminstances_volumes_delete_parameters.go | 59 +- ...d_pvminstances_volumes_delete_responses.go | 50 +- ...oud_pvminstances_volumes_get_parameters.go | 59 +- ...loud_pvminstances_volumes_get_responses.go | 38 +- ..._pvminstances_volumes_getall_parameters.go | 54 +- ...d_pvminstances_volumes_getall_responses.go | 38 +- ...ud_pvminstances_volumes_post_parameters.go | 59 +- ...oud_pvminstances_volumes_post_responses.go | 50 +- ...oud_pvminstances_volumes_put_parameters.go | 67 +- ...loud_pvminstances_volumes_put_responses.go | 26 +- ...nstances_volumes_setboot_put_parameters.go | 59 +- ...instances_volumes_setboot_put_responses.go | 38 +- ...v2_pvminstances_volumes_post_parameters.go | 62 +- ..._v2_pvminstances_volumes_post_responses.go | 38 +- ...pcloud_v2_volumes_clone_post_parameters.go | 57 +- .../pcloud_v2_volumes_clone_post_responses.go | 38 +- ...ud_v2_volumes_clonetasks_get_parameters.go | 54 +- ...oud_v2_volumes_clonetasks_get_responses.go | 44 +- .../pcloud_v2_volumes_post_parameters.go | 57 +- .../pcloud_v2_volumes_post_responses.go | 44 +- ..._v2_volumesclone_cancel_post_parameters.go | 62 +- ...d_v2_volumesclone_cancel_post_responses.go | 32 +- ...cloud_v2_volumesclone_delete_parameters.go | 54 +- ...pcloud_v2_volumesclone_delete_responses.go | 38 +- ...v2_volumesclone_execute_post_parameters.go | 62 +- ..._v2_volumesclone_execute_post_responses.go | 38 +- .../pcloud_v2_volumesclone_get_parameters.go | 54 +- .../pcloud_v2_volumesclone_get_responses.go | 38 +- ...cloud_v2_volumesclone_getall_parameters.go | 73 +- ...pcloud_v2_volumesclone_getall_responses.go | 38 +- .../pcloud_v2_volumesclone_post_parameters.go | 57 +- .../pcloud_v2_volumesclone_post_responses.go | 44 +- ...d_v2_volumesclone_start_post_parameters.go | 54 +- ...ud_v2_volumesclone_start_post_responses.go | 32 +- .../pcloud_volumes_clone_post_parameters.go | 57 +- .../pcloud_volumes_clone_post_responses.go | 38 +- ...aas_client.go => power_iaas_api_client.go} | 167 +--- .../service_binding_binding_parameters.go | 81 +- .../service_binding_binding_responses.go | 44 +- .../service_binding_get_parameters.go | 65 +- .../service_binding_get_responses.go | 20 +- ...e_binding_last_operation_get_parameters.go | 83 +- ...ce_binding_last_operation_get_responses.go | 26 +- .../service_binding_unbinding_parameters.go | 85 +- .../service_binding_unbinding_responses.go | 32 +- .../service_bindings_client.go | 109 ++- ...service_instance_deprovision_parameters.go | 80 +- .../service_instance_deprovision_responses.go | 38 +- .../service_instance_get_parameters.go | 60 +- .../service_instance_get_responses.go | 20 +- ..._instance_last_operation_get_parameters.go | 78 +- ...e_instance_last_operation_get_responses.go | 26 +- .../service_instance_provision_parameters.go | 76 +- .../service_instance_provision_responses.go | 44 +- .../service_instance_update_parameters.go | 76 +- .../service_instance_update_responses.go | 32 +- .../service_instances_client.go | 130 ++- ...vice_broker_storagetypes_get_parameters.go | 45 +- ...rvice_broker_storagetypes_get_responses.go | 20 +- .../storage_types/storage_types_client.go | 41 +- .../service_broker_swaggerspec_parameters.go | 45 +- .../service_broker_swaggerspec_responses.go | 14 +- .../swagger_spec/swagger_spec_client.go | 41 +- power/models/access_token.go | 9 +- power/models/async_operation.go | 9 +- power/models/available_stock_images.go | 29 +- power/models/catalog.go | 42 +- power/models/clone_task_reference.go | 9 +- power/models/clone_task_status.go | 44 +- power/models/cloned_volume.go | 9 +- power/models/cloned_volume_detail.go | 58 +- power/models/cloud_connection.go | 88 +- power/models/cloud_connection_create.go | 63 +- .../cloud_connection_create_response.go | 42 +- .../cloud_connection_endpoint_classic.go | 37 +- ...loud_connection_endpoint_classic_update.go | 37 +- .../models/cloud_connection_endpoint_v_p_c.go | 42 +- power/models/cloud_connection_g_r_e_tunnel.go | 9 +- .../cloud_connection_g_r_e_tunnel_create.go | 9 +- power/models/cloud_connection_update.go | 64 +- power/models/cloud_connection_v_p_c.go | 9 +- ...cloud_connection_virtual_private_clouds.go | 47 +- power/models/cloud_connections.go | 41 +- power/models/cloud_instance.go | 85 +- power/models/cloud_instance_create.go | 9 +- power/models/cloud_instance_reference.go | 36 +- power/models/cloud_instance_update.go | 9 +- power/models/cloud_instance_usage_limits.go | 9 +- power/models/console_language.go | 9 +- power/models/console_languages.go | 41 +- power/models/context.go | 1 + power/models/create_cos_image_import_job.go | 44 +- power/models/create_data_volume.go | 17 +- power/models/create_image.go | 47 +- power/models/d_h_c_p_server.go | 36 +- power/models/d_h_c_p_server_detail.go | 64 +- power/models/d_h_c_p_server_leases.go | 9 +- power/models/d_h_c_p_server_network.go | 9 +- power/models/d_h_c_p_servers.go | 32 +- power/models/dashboard_client.go | 9 +- power/models/dead_peer_detection.go | 22 +- power/models/device_code.go | 9 +- power/models/error.go | 9 +- power/models/event.go | 40 +- power/models/event_user.go | 9 +- power/models/events.go | 41 +- power/models/export_image.go | 9 +- power/models/hardware_platform.go | 42 +- power/models/hardware_platforms.go | 24 +- power/models/health.go | 9 +- power/models/host_info.go | 85 +- power/models/host_p_vm_instance.go | 36 +- power/models/host_resource.go | 9 +- power/models/host_resources.go | 9 +- power/models/i_k_e_policies.go | 41 +- power/models/i_k_e_policy.go | 138 ++- power/models/i_k_e_policy_authentication.go | 26 +- power/models/i_k_e_policy_authentications.go | 11 +- power/models/i_k_e_policy_create.go | 120 ++- power/models/i_k_e_policy_dh_groups.go | 11 +- power/models/i_k_e_policy_encryptions.go | 11 +- power/models/i_k_e_policy_options.go | 94 +- power/models/i_k_e_policy_ref.go | 11 +- power/models/i_k_e_policy_template.go | 60 +- power/models/i_k_e_policy_update.go | 162 +++- power/models/image.go | 88 +- power/models/image_reference.go | 36 +- power/models/image_specifications.go | 9 +- power/models/image_volume.go | 9 +- power/models/images.go | 41 +- power/models/ip_address_range.go | 9 +- .../models/ip_s_e_c_policy_authentication.go | 30 +- .../models/ip_s_e_c_policy_authentications.go | 11 +- power/models/ip_s_e_c_policy_dh_groups.go | 11 +- power/models/ip_s_e_c_policy_encryptions.go | 11 +- power/models/ip_sec_policies.go | 41 +- power/models/ip_sec_policy.go | 140 ++- power/models/ip_sec_policy_create.go | 122 ++- power/models/ip_sec_policy_options.go | 74 +- power/models/ip_sec_policy_ref.go | 11 +- power/models/ip_sec_policy_template.go | 59 +- power/models/ip_sec_policy_update.go | 160 +++- power/models/job.go | 59 +- power/models/job_reference.go | 9 +- power/models/jobs.go | 41 +- power/models/json_schema_object.go | 1 + power/models/key_lifetime.go | 10 +- power/models/last_operation_resource.go | 12 +- power/models/maximum_storage_allocation.go | 9 +- power/models/metadata.go | 1 + power/models/min_max_default.go | 9 +- power/models/multi_volumes_create.go | 17 +- power/models/network.go | 135 ++- power/models/network_create.go | 48 +- power/models/network_i_ds.go | 51 + power/models/network_id.go | 10 +- power/models/network_port.go | 43 +- power/models/network_port_create.go | 9 +- power/models/network_port_update.go | 9 +- power/models/network_ports.go | 41 +- power/models/network_reference.go | 16 +- power/models/network_update.go | 42 +- power/models/networks.go | 41 +- power/models/object.go | 1 + power/models/open_stack.go | 9 +- power/models/open_stack_create.go | 9 +- power/models/open_stack_info.go | 41 +- power/models/open_stacks.go | 41 +- power/models/operation.go | 9 +- power/models/operations.go | 19 +- power/models/options.go | 36 +- power/models/owner_info.go | 43 +- power/models/p_vm_instance.go | 262 ++++- power/models/p_vm_instance_action.go | 28 +- power/models/p_vm_instance_add_network.go | 9 +- power/models/p_vm_instance_address.go | 27 +- power/models/p_vm_instance_capture.go | 22 +- power/models/p_vm_instance_clone.go | 69 +- power/models/p_vm_instance_console.go | 9 +- power/models/p_vm_instance_create.go | 151 ++- power/models/p_vm_instance_fault.go | 10 +- power/models/p_vm_instance_health.go | 9 +- power/models/p_vm_instance_list.go | 32 +- power/models/p_vm_instance_multi_create.go | 20 +- power/models/p_vm_instance_network.go | 9 +- power/models/p_vm_instance_networks.go | 41 +- power/models/p_vm_instance_operation.go | 39 +- power/models/p_vm_instance_reference.go | 242 ++++- power/models/p_vm_instance_remove_network.go | 9 +- power/models/p_vm_instance_update.go | 85 +- power/models/p_vm_instance_update_response.go | 39 +- power/models/p_vm_instance_volume_update.go | 9 +- power/models/p_vm_instances.go | 41 +- power/models/peer_gateway_address.go | 10 +- power/models/peer_subnet_update.go | 10 +- power/models/peer_subnets.go | 10 +- power/models/peering_network.go | 9 +- power/models/pin_policy.go | 17 +- power/models/placement_group.go | 16 +- power/models/placement_group_create.go | 16 +- power/models/placement_group_server.go | 9 +- power/models/placement_groups.go | 41 +- power/models/plan.go | 37 +- power/models/policy_versions.go | 11 +- power/models/region_storage_types.go | 32 +- power/models/s_a_p_create.go | 110 ++- power/models/s_a_p_profile.go | 20 +- power/models/s_a_p_profile_reference.go | 9 +- power/models/s_a_p_profiles.go | 41 +- power/models/s_r_c.go | 9 +- power/models/schema_parameters.go | 9 +- power/models/schemas_object.go | 60 +- power/models/service.go | 67 +- power/models/service_binding.go | 42 +- power/models/service_binding_request.go | 37 +- power/models/service_binding_resource.go | 42 +- .../models/service_binding_resource_object.go | 9 +- power/models/service_binding_schema_object.go | 37 +- power/models/service_binding_volume_mount.go | 41 +- .../service_binding_volume_mount_device.go | 9 +- power/models/service_instance.go | 9 +- .../service_instance_async_operation.go | 9 +- .../service_instance_previous_values.go | 9 +- power/models/service_instance_provision.go | 9 +- .../service_instance_provision_request.go | 9 +- power/models/service_instance_request.go | 9 +- power/models/service_instance_resource.go | 9 +- .../models/service_instance_schema_object.go | 60 +- .../models/service_instance_update_request.go | 37 +- power/models/snapshot.go | 15 +- power/models/snapshot_create.go | 11 +- power/models/snapshot_create_response.go | 9 +- power/models/snapshot_restore.go | 9 +- power/models/snapshot_update.go | 9 +- power/models/snapshots.go | 41 +- power/models/softlayer_subscription.go | 9 +- power/models/software_licenses.go | 9 +- power/models/ssh_key.go | 10 +- power/models/ssh_keys.go | 41 +- power/models/status.go | 9 +- power/models/stock_image.go | 9 +- power/models/stock_images.go | 32 +- power/models/storage_affinity.go | 17 +- power/models/storage_entities.go | 9 +- power/models/storage_pool.go | 40 +- power/models/storage_pool_capacity.go | 9 +- power/models/storage_pools.go | 32 +- power/models/storage_pools_capacity.go | 65 +- power/models/storage_type.go | 13 +- power/models/storage_type_capacity.go | 65 +- power/models/storage_types.go | 29 +- power/models/storage_types_capacity.go | 65 +- power/models/system.go | 9 +- power/models/system_pool.go | 157 ++- power/models/system_pools.go | 24 +- power/models/task.go | 9 +- power/models/task_reference.go | 9 +- power/models/tenant.go | 95 +- power/models/tenant_update.go | 42 +- power/models/thresholds.go | 129 ++- power/models/token.go | 9 +- power/models/token_extra.go | 36 +- power/models/token_request.go | 12 +- power/models/update_storage_pool.go | 41 +- power/models/update_volume.go | 9 +- power/models/user_info.go | 9 +- power/models/v_p_n_connection.go | 141 ++- power/models/v_p_n_connection_create.go | 65 +- .../v_p_n_connection_create_response.go | 42 +- power/models/v_p_n_connection_update.go | 87 +- power/models/v_p_n_connections.go | 43 +- power/models/v_p_naa_s_options.go | 124 ++- power/models/version.go | 9 +- power/models/virtual_cores.go | 11 +- power/models/volume.go | 11 +- power/models/volume_action.go | 9 +- power/models/volume_info.go | 9 +- power/models/volume_reference.go | 11 +- power/models/volumes.go | 41 +- power/models/volumes_attach.go | 17 +- power/models/volumes_attachment_response.go | 9 +- power/models/volumes_clone.go | 11 +- power/models/volumes_clone_async_request.go | 17 +- power/models/volumes_clone_cancel.go | 9 +- power/models/volumes_clone_create.go | 17 +- power/models/volumes_clone_detail.go | 44 +- power/models/volumes_clone_execute.go | 9 +- power/models/volumes_clone_request.go | 17 +- power/models/volumes_clone_response.go | 9 +- power/models/volumes_clones.go | 42 +- utils/utils.go | 62 -- 623 files changed, 22267 insertions(+), 9893 deletions(-) delete mode 100644 power/client/p_cloud_p_vm_instances/p_cloud_p_vm_instances_client.go create mode 100644 power/client/p_cloud_p_vm_instances/p_cloudp_vm_instances_client.go rename power/client/p_cloud_s_a_p/{p_cloud_s_a_p_client.go => p_cloudsap_client.go} (53%) delete mode 100644 power/client/p_cloud_service_d_h_c_p/p_cloud_service_d_h_c_p_client.go create mode 100644 power/client/p_cloud_service_d_h_c_p/p_cloud_servicedhcp_client.go delete mode 100644 power/client/p_cloud_v_p_n_connections/p_cloud_v_p_n_connections_client.go create mode 100644 power/client/p_cloud_v_p_n_connections/p_cloudvpn_connections_client.go delete mode 100644 power/client/p_cloud_v_p_n_policies/p_cloud_v_p_n_policies_client.go create mode 100644 power/client/p_cloud_v_p_n_policies/p_cloudvpn_policies_client.go rename power/client/{power_iaas_client.go => power_iaas_api_client.go} (74%) create mode 100644 power/models/network_i_ds.go delete mode 100644 utils/utils.go diff --git a/.gitignore b/.gitignore index 396f67d5..4c567364 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /.idea/misc.xml /.idea/vcs.xml /.idea/ +/vendor/ \ No newline at end of file diff --git a/clients/instance/ibm-pi-dhcp.go b/clients/instance/ibm-pi-dhcp.go index 0b4a4cfa..81fad8dc 100644 --- a/clients/instance/ibm-pi-dhcp.go +++ b/clients/instance/ibm-pi-dhcp.go @@ -29,7 +29,7 @@ func (f *IBMPIDhcpClient) Create() (*models.DHCPServer, error) { params := p_cloud_service_d_h_c_p.NewPcloudDhcpPostParams(). WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). WithCloudInstanceID(f.cloudInstanceID) - postaccepted, err := f.session.Power.PCloudServiceDHCP.PcloudDhcpPost(params, f.authInfo) + postaccepted, err := f.session.Power.PCloudServicedhcp.PcloudDhcpPost(params, f.authInfo) if err != nil { return nil, fmt.Errorf(errors.CreateDchpOperationFailed, f.cloudInstanceID, err) } @@ -44,7 +44,7 @@ func (f *IBMPIDhcpClient) Get(id string) (*models.DHCPServerDetail, error) { params := p_cloud_service_d_h_c_p.NewPcloudDhcpGetParams(). WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithDhcpID(id) - resp, err := f.session.Power.PCloudServiceDHCP.PcloudDhcpGet(params, f.authInfo) + resp, err := f.session.Power.PCloudServicedhcp.PcloudDhcpGet(params, f.authInfo) if err != nil { return nil, fmt.Errorf(errors.GetDhcpOperationFailed, id, err) } @@ -59,7 +59,7 @@ func (f *IBMPIDhcpClient) GetAll() (models.DHCPServers, error) { params := p_cloud_service_d_h_c_p.NewPcloudDhcpGetallParams(). WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). WithCloudInstanceID(f.cloudInstanceID) - resp, err := f.session.Power.PCloudServiceDHCP.PcloudDhcpGetall(params, f.authInfo) + resp, err := f.session.Power.PCloudServicedhcp.PcloudDhcpGetall(params, f.authInfo) if err != nil { return nil, fmt.Errorf("failed to Get all DHCP servers: %w", err) } @@ -74,7 +74,7 @@ func (f *IBMPIDhcpClient) Delete(id string) error { params := p_cloud_service_d_h_c_p.NewPcloudDhcpDeleteParams(). WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithDhcpID(id) - _, err := f.session.Power.PCloudServiceDHCP.PcloudDhcpDelete(params, f.authInfo) + _, err := f.session.Power.PCloudServicedhcp.PcloudDhcpDelete(params, f.authInfo) if err != nil { return fmt.Errorf(errors.DeleteDhcpOperationFailed, id, err) } diff --git a/clients/instance/ibm-pi-instance.go b/clients/instance/ibm-pi-instance.go index 03c621ab..ef8a7bd9 100644 --- a/clients/instance/ibm-pi-instance.go +++ b/clients/instance/ibm-pi-instance.go @@ -27,7 +27,7 @@ func (f *IBMPIInstanceClient) Get(id string) (*models.PVMInstance, error) { params := p_cloud_p_vm_instances.NewPcloudPvminstancesGetParams(). WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id) - resp, err := f.session.Power.PCloudPVMInstances.PcloudPvminstancesGet(params, f.authInfo) + resp, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesGet(params, f.authInfo) if err != nil { return nil, fmt.Errorf("failed to Get PVM Instance %s :%w", id, err) } @@ -42,7 +42,7 @@ func (f *IBMPIInstanceClient) GetAll() (*models.PVMInstances, error) { params := p_cloud_p_vm_instances.NewPcloudPvminstancesGetallParams(). WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). WithCloudInstanceID(f.cloudInstanceID) - resp, err := f.session.Power.PCloudPVMInstances.PcloudPvminstancesGetall(params, f.authInfo) + resp, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesGetall(params, f.authInfo) if err != nil { return nil, fmt.Errorf("failed to Get all PVM Instances of Power Instance %s :%w", f.cloudInstanceID, err) } @@ -57,7 +57,7 @@ func (f *IBMPIInstanceClient) Create(body *models.PVMInstanceCreate) (*models.PV params := p_cloud_p_vm_instances.NewPcloudPvminstancesPostParams(). WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithBody(body) - postok, postcreated, postAccepted, err := f.session.Power.PCloudPVMInstances.PcloudPvminstancesPost(params, ibmpisession.NewAuth(f.session, f.cloudInstanceID)) + postok, postcreated, postAccepted, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesPost(params, ibmpisession.NewAuth(f.session, f.cloudInstanceID)) if err != nil { return nil, fmt.Errorf("failed to Create PVM Instance :%w", err) } @@ -78,7 +78,7 @@ func (f *IBMPIInstanceClient) Delete(id string) error { params := p_cloud_p_vm_instances.NewPcloudPvminstancesDeleteParams(). WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id) - _, err := f.session.Power.PCloudPVMInstances.PcloudPvminstancesDelete(params, f.authInfo) + _, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesDelete(params, f.authInfo) if err != nil { return fmt.Errorf("failed to Delete PVM Instance %s :%w", id, err) } @@ -90,7 +90,7 @@ func (f *IBMPIInstanceClient) Update(id string, body *models.PVMInstanceUpdate) params := p_cloud_p_vm_instances.NewPcloudPvminstancesPutParams(). WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id).WithBody(body) - resp, err := f.session.Power.PCloudPVMInstances.PcloudPvminstancesPut(params, f.authInfo) + resp, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesPut(params, f.authInfo) if err != nil { return nil, fmt.Errorf("failed to Update PVM Instance %s :%w", id, err) } @@ -106,7 +106,7 @@ func (f *IBMPIInstanceClient) Action(id string, body *models.PVMInstanceAction) WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id). WithBody(body) - _, err := f.session.Power.PCloudPVMInstances.PcloudPvminstancesActionPost(params, f.authInfo) + _, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesActionPost(params, f.authInfo) if err != nil { return fmt.Errorf("failed to perform Action on PVM Instance %s :%w", id, err) } @@ -119,7 +119,7 @@ func (f *IBMPIInstanceClient) PostConsoleURL(id string) (*models.PVMInstanceCons params := p_cloud_p_vm_instances.NewPcloudPvminstancesConsolePostParams(). WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id) - postok, err := f.session.Power.PCloudPVMInstances.PcloudPvminstancesConsolePost(params, f.authInfo) + postok, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesConsolePost(params, f.authInfo) if err != nil { return nil, fmt.Errorf("failed to Generate the Console URL PVM Instance %s :%w", id, err) } @@ -134,7 +134,7 @@ func (f *IBMPIInstanceClient) GetConsoleLanguages(id string) (*models.ConsoleLan params := p_cloud_p_vm_instances.NewPcloudPvminstancesConsoleGetParams(). WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id) - resp, err := f.session.Power.PCloudPVMInstances.PcloudPvminstancesConsoleGet(params, f.authInfo) + resp, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesConsoleGet(params, f.authInfo) if err != nil { return nil, fmt.Errorf("failed to Get Console Languages for PVM Instance %s :%w", id, err) } @@ -150,7 +150,7 @@ func (f *IBMPIInstanceClient) UpdateConsoleLanguage(id string, body *models.Cons WithContext(f.ctx).WithTimeout(helpers.PIUpdateTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id). WithBody(body) - resp, err := f.session.Power.PCloudPVMInstances.PcloudPvminstancesConsolePut(params, f.authInfo) + resp, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesConsolePut(params, f.authInfo) if err != nil { return nil, fmt.Errorf("failed to Update Console Language for PVM Instance %s :%w", id, err) } @@ -166,7 +166,7 @@ func (f *IBMPIInstanceClient) CaptureInstanceToImageCatalog(id string, body *mod WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id). WithBody(body) - _, _, err := f.session.Power.PCloudPVMInstances.PcloudPvminstancesCapturePost(params, f.authInfo) + _, _, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesCapturePost(params, f.authInfo) if err != nil { return fmt.Errorf("failed to Capture the PVM Instance %s: %w", id, err) } @@ -180,7 +180,7 @@ func (f *IBMPIInstanceClient) CaptureInstanceToImageCatalogV2(id string, body *m WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id). WithBody(body) - resp, err := f.session.Power.PCloudPVMInstances.PcloudV2PvminstancesCapturePost(params, f.authInfo) + resp, err := f.session.Power.PCloudpVMInstances.PcloudV2PvminstancesCapturePost(params, f.authInfo) if err != nil { return nil, fmt.Errorf("failed to Capture the PVM Instance %s: %w", id, err) } @@ -196,7 +196,7 @@ func (f *IBMPIInstanceClient) CreatePvmSnapShot(id string, body *models.Snapshot WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id). WithBody(body) - snapshotpostaccepted, err := f.session.Power.PCloudPVMInstances.PcloudPvminstancesSnapshotsPost(params, f.authInfo) + snapshotpostaccepted, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesSnapshotsPost(params, f.authInfo) if err != nil { return nil, fmt.Errorf("failed to Create the snapshot for the pvminstance %s: %w", id, err) } @@ -212,7 +212,7 @@ func (f *IBMPIInstanceClient) CreateClone(id string, body *models.PVMInstanceClo WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id). WithBody(body) - clonePost, err := f.session.Power.PCloudPVMInstances.PcloudPvminstancesClonePost(params, f.authInfo) + clonePost, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesClonePost(params, f.authInfo) if err != nil { return nil, fmt.Errorf("failed to create the clone of the pvm instance %s: %w", id, err) } @@ -227,7 +227,7 @@ func (f *IBMPIInstanceClient) GetSnapShotVM(id string) (*models.Snapshots, error params := p_cloud_p_vm_instances.NewPcloudPvminstancesSnapshotsGetallParams(). WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id) - resp, err := f.session.Power.PCloudPVMInstances.PcloudPvminstancesSnapshotsGetall(params, f.authInfo) + resp, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesSnapshotsGetall(params, f.authInfo) if err != nil { return nil, fmt.Errorf("failed to Get the snapshot for the pvminstance %s: %w", id, err) } @@ -245,7 +245,7 @@ func (f *IBMPIInstanceClient) RestoreSnapShotVM(id, snapshotid, restoreAction st WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id). WithSnapshotID(snapshotid).WithRestoreFailAction(&restoreAction). WithBody(body) - resp, err := f.session.Power.PCloudPVMInstances.PcloudPvminstancesSnapshotsRestorePost(params, f.authInfo) + resp, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesSnapshotsRestorePost(params, f.authInfo) if err != nil || resp == nil || resp.Payload == nil { return nil, fmt.Errorf("failed to restrore the snapshot for the pvminstance %s: %w", id, err) } @@ -261,7 +261,7 @@ func (f *IBMPIInstanceClient) AddNetwork(id string, body *models.PVMInstanceAddN WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id). WithBody(body) - resp, err := f.session.Power.PCloudPVMInstances.PcloudPvminstancesNetworksPost(params, f.authInfo) + resp, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesNetworksPost(params, f.authInfo) if err != nil { return nil, fmt.Errorf("failed to attach the network to the pvminstanceid %s: %w", id, err) } @@ -277,7 +277,7 @@ func (f *IBMPIInstanceClient) DeleteNetwork(id string, body *models.PVMInstanceR WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id). WithBody(body) - _, err := f.session.Power.PCloudPVMInstances.PcloudPvminstancesNetworksDelete(params, f.authInfo) + _, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesNetworksDelete(params, f.authInfo) if err != nil { return fmt.Errorf("failed to delete the network to the pvminstanceid %s: %w", id, err) } diff --git a/clients/instance/ibm-pi-sap-instance.go b/clients/instance/ibm-pi-sap-instance.go index 2f2968fa..9f0feeed 100644 --- a/clients/instance/ibm-pi-sap-instance.go +++ b/clients/instance/ibm-pi-sap-instance.go @@ -27,7 +27,7 @@ func (f *IBMPISAPInstanceClient) Create(body *models.SAPCreate) (*models.PVMInst params := p_cloud_s_a_p.NewPcloudSapPostParams(). WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithBody(body) - postok, postcreated, postAccepted, err := f.session.Power.PCloudSAP.PcloudSapPost(params, f.authInfo) + postok, postcreated, postAccepted, err := f.session.Power.PCloudsap.PcloudSapPost(params, f.authInfo) if err != nil { return nil, fmt.Errorf("failed to Create SAP Instance: %w", err) } @@ -48,7 +48,7 @@ func (f *IBMPISAPInstanceClient) GetSAPProfile(id string) (*models.SAPProfile, e params := p_cloud_s_a_p.NewPcloudSapGetParams(). WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithSapProfileID(id) - resp, err := f.session.Power.PCloudSAP.PcloudSapGet(params, f.authInfo) + resp, err := f.session.Power.PCloudsap.PcloudSapGet(params, f.authInfo) if err != nil { return nil, fmt.Errorf("failed to get sap profile %s : %w", id, err) } @@ -63,7 +63,7 @@ func (f *IBMPISAPInstanceClient) GetAllSAPProfiles(cloudInstanceID string) (*mod params := p_cloud_s_a_p.NewPcloudSapGetallParams(). WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). WithCloudInstanceID(f.cloudInstanceID) - resp, err := f.session.Power.PCloudSAP.PcloudSapGetall(params, f.authInfo) + resp, err := f.session.Power.PCloudsap.PcloudSapGetall(params, f.authInfo) if err != nil { return nil, fmt.Errorf("failed to get all sap profiles for power instance %s: %w", cloudInstanceID, err) } diff --git a/clients/instance/ibm-pi-snapshot.go b/clients/instance/ibm-pi-snapshot.go index e78362b0..b2cb038f 100644 --- a/clients/instance/ibm-pi-snapshot.go +++ b/clients/instance/ibm-pi-snapshot.go @@ -87,7 +87,7 @@ func (f *IBMPISnapshotClient) Create(instanceID, snapshotID, restoreFailAction s WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(instanceID). WithSnapshotID(snapshotID).WithRestoreFailAction(&restoreFailAction) - resp, err := f.session.Power.PCloudPVMInstances.PcloudPvminstancesSnapshotsRestorePost(params, f.authInfo) + resp, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesSnapshotsRestorePost(params, f.authInfo) if err != nil { return nil, fmt.Errorf("failed to restore PI Snapshot %s of the instance %s: %w", snapshotID, instanceID, err) } diff --git a/clients/instance/ibm-pi-vpn-policy.go b/clients/instance/ibm-pi-vpn-policy.go index 0d658bbe..57a9e91d 100644 --- a/clients/instance/ibm-pi-vpn-policy.go +++ b/clients/instance/ibm-pi-vpn-policy.go @@ -31,7 +31,7 @@ func (f *IBMPIVpnPolicyClient) GetIKEPolicy(id string) (*models.IKEPolicy, error params := p_cloud_v_p_n_policies.NewPcloudIkepoliciesGetParams(). WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithIkePolicyID(id) - resp, err := f.session.Power.PCloudVPNPolicies.PcloudIkepoliciesGet(params, f.authInfo) + resp, err := f.session.Power.PCloudvpnPolicies.PcloudIkepoliciesGet(params, f.authInfo) if err != nil { return nil, fmt.Errorf(errors.GetVPNPolicyOperationFailed, id, err) } @@ -46,7 +46,7 @@ func (f *IBMPIVpnPolicyClient) CreateIKEPolicy(body *models.IKEPolicyCreate) (*m params := p_cloud_v_p_n_policies.NewPcloudIkepoliciesPostParams(). WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithBody(body) - postok, err := f.session.Power.PCloudVPNPolicies.PcloudIkepoliciesPost(params, f.authInfo) + postok, err := f.session.Power.PCloudvpnPolicies.PcloudIkepoliciesPost(params, f.authInfo) if err != nil { return nil, fmt.Errorf(errors.CreateVPNPolicyOperationFailed, f.cloudInstanceID, err) } @@ -62,7 +62,7 @@ func (f *IBMPIVpnPolicyClient) UpdateIKEPolicy(id string, body *models.IKEPolicy WithContext(f.ctx).WithTimeout(helpers.PIUpdateTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithIkePolicyID(id). WithBody(body) - putok, err := f.session.Power.PCloudVPNPolicies.PcloudIkepoliciesPut(params, f.authInfo) + putok, err := f.session.Power.PCloudvpnPolicies.PcloudIkepoliciesPut(params, f.authInfo) if err != nil { return nil, fmt.Errorf(errors.UpdateVPNPolicyOperationFailed, id, err) } @@ -77,7 +77,7 @@ func (f *IBMPIVpnPolicyClient) GetAllIKEPolicies() (*models.IKEPolicies, error) params := p_cloud_v_p_n_policies.NewPcloudIkepoliciesGetallParams(). WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). WithCloudInstanceID(f.cloudInstanceID) - resp, err := f.session.Power.PCloudVPNPolicies.PcloudIkepoliciesGetall(params, f.authInfo) + resp, err := f.session.Power.PCloudvpnPolicies.PcloudIkepoliciesGetall(params, f.authInfo) if err != nil { return nil, fmt.Errorf("failed to get all ike policies: %w", err) } @@ -92,7 +92,7 @@ func (f *IBMPIVpnPolicyClient) DeleteIKEPolicy(id string) error { params := p_cloud_v_p_n_policies.NewPcloudIkepoliciesDeleteParams(). WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithIkePolicyID(id) - _, err := f.session.Power.PCloudVPNPolicies.PcloudIkepoliciesDelete(params, f.authInfo) + _, err := f.session.Power.PCloudvpnPolicies.PcloudIkepoliciesDelete(params, f.authInfo) if err != nil { return fmt.Errorf(errors.DeleteVPNPolicyOperationFailed, id, err) } @@ -106,7 +106,7 @@ func (f *IBMPIVpnPolicyClient) GetIPSecPolicy(id string) (*models.IPSecPolicy, e params := p_cloud_v_p_n_policies.NewPcloudIpsecpoliciesGetParams(). WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithIpsecPolicyID(id) - resp, err := f.session.Power.PCloudVPNPolicies.PcloudIpsecpoliciesGet(params, f.authInfo) + resp, err := f.session.Power.PCloudvpnPolicies.PcloudIpsecpoliciesGet(params, f.authInfo) if err != nil { return nil, fmt.Errorf(errors.GetVPNPolicyOperationFailed, id, err) } @@ -121,7 +121,7 @@ func (f *IBMPIVpnPolicyClient) CreateIPSecPolicy(body *models.IPSecPolicyCreate) params := p_cloud_v_p_n_policies.NewPcloudIpsecpoliciesPostParams(). WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithBody(body) - postok, err := f.session.Power.PCloudVPNPolicies.PcloudIpsecpoliciesPost(params, f.authInfo) + postok, err := f.session.Power.PCloudvpnPolicies.PcloudIpsecpoliciesPost(params, f.authInfo) if err != nil { return nil, fmt.Errorf(errors.CreateVPNPolicyOperationFailed, f.cloudInstanceID, err) } @@ -137,7 +137,7 @@ func (f *IBMPIVpnPolicyClient) UpdateIPSecPolicy(id string, body *models.IPSecPo WithContext(f.ctx).WithTimeout(helpers.PIUpdateTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithIpsecPolicyID(id). WithBody(body) - putok, err := f.session.Power.PCloudVPNPolicies.PcloudIpsecpoliciesPut(params, f.authInfo) + putok, err := f.session.Power.PCloudvpnPolicies.PcloudIpsecpoliciesPut(params, f.authInfo) if err != nil { return nil, fmt.Errorf(errors.UpdateVPNPolicyOperationFailed, id, err) } @@ -152,7 +152,7 @@ func (f *IBMPIVpnPolicyClient) GetAllIPSecPolicies() (*models.IPSecPolicies, err params := p_cloud_v_p_n_policies.NewPcloudIpsecpoliciesGetallParams(). WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). WithCloudInstanceID(f.cloudInstanceID) - resp, err := f.session.Power.PCloudVPNPolicies.PcloudIpsecpoliciesGetall(params, f.authInfo) + resp, err := f.session.Power.PCloudvpnPolicies.PcloudIpsecpoliciesGetall(params, f.authInfo) if err != nil { return nil, fmt.Errorf("failed to get all ipsec policies: %w", err) } @@ -167,7 +167,7 @@ func (f *IBMPIVpnPolicyClient) DeleteIPSecPolicy(id string) error { params := p_cloud_v_p_n_policies.NewPcloudIpsecpoliciesDeleteParams(). WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithIpsecPolicyID(id) - _, err := f.session.Power.PCloudVPNPolicies.PcloudIpsecpoliciesDelete(params, f.authInfo) + _, err := f.session.Power.PCloudvpnPolicies.PcloudIpsecpoliciesDelete(params, f.authInfo) if err != nil { return fmt.Errorf(errors.DeleteVPNPolicyOperationFailed, id, err) } diff --git a/clients/instance/ibm-pi-vpn.go b/clients/instance/ibm-pi-vpn.go index fc7dbcc0..e5b05aa0 100644 --- a/clients/instance/ibm-pi-vpn.go +++ b/clients/instance/ibm-pi-vpn.go @@ -29,7 +29,7 @@ func (f *IBMPIVpnConnectionClient) Get(id string) (*models.VPNConnection, error) params := p_cloud_v_p_n_connections.NewPcloudVpnconnectionsGetParams(). WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithVpnConnectionID(id) - resp, err := f.session.Power.PCloudVPNConnections.PcloudVpnconnectionsGet(params, f.authInfo) + resp, err := f.session.Power.PCloudvpnConnections.PcloudVpnconnectionsGet(params, f.authInfo) if err != nil { return nil, fmt.Errorf(errors.GetVPNConnectionOperationFailed, id, err) } @@ -44,7 +44,7 @@ func (f *IBMPIVpnConnectionClient) Create(body *models.VPNConnectionCreate) (*mo params := p_cloud_v_p_n_connections.NewPcloudVpnconnectionsPostParams(). WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithBody(body) - postaccepted, err := f.session.Power.PCloudVPNConnections.PcloudVpnconnectionsPost(params, f.authInfo) + postaccepted, err := f.session.Power.PCloudvpnConnections.PcloudVpnconnectionsPost(params, f.authInfo) if err != nil { return nil, fmt.Errorf(errors.CreateVPNConnectionOperationFailed, f.cloudInstanceID, err) } @@ -60,7 +60,7 @@ func (f *IBMPIVpnConnectionClient) Update(id string, body *models.VPNConnectionU WithContext(f.ctx).WithTimeout(helpers.PIUpdateTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithVpnConnectionID(id). WithBody(body) - putok, err := f.session.Power.PCloudVPNConnections.PcloudVpnconnectionsPut(params, f.authInfo) + putok, err := f.session.Power.PCloudvpnConnections.PcloudVpnconnectionsPut(params, f.authInfo) if err != nil { return nil, fmt.Errorf(errors.UpdateVPNConnectionOperationFailed, id, err) } @@ -75,7 +75,7 @@ func (f *IBMPIVpnConnectionClient) GetAll() (*models.VPNConnections, error) { params := p_cloud_v_p_n_connections.NewPcloudVpnconnectionsGetallParams(). WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). WithCloudInstanceID(f.cloudInstanceID) - resp, err := f.session.Power.PCloudVPNConnections.PcloudVpnconnectionsGetall(params, f.authInfo) + resp, err := f.session.Power.PCloudvpnConnections.PcloudVpnconnectionsGetall(params, f.authInfo) if err != nil { return nil, fmt.Errorf("failed to Get all VPN Connections: %w", err) } @@ -90,7 +90,7 @@ func (f *IBMPIVpnConnectionClient) Delete(id string) (*models.JobReference, erro params := p_cloud_v_p_n_connections.NewPcloudVpnconnectionsDeleteParams(). WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithVpnConnectionID(id) - delaccepted, err := f.session.Power.PCloudVPNConnections.PcloudVpnconnectionsDelete(params, f.authInfo) + delaccepted, err := f.session.Power.PCloudvpnConnections.PcloudVpnconnectionsDelete(params, f.authInfo) if err != nil { return nil, fmt.Errorf(errors.DeleteVPNConnectionOperationFailed, id, err) } @@ -101,11 +101,11 @@ func (f *IBMPIVpnConnectionClient) Delete(id string) (*models.JobReference, erro } // Network get -func (f *IBMPIVpnConnectionClient) GetNetwork(id string) (*models.NetworkIds, error) { +func (f *IBMPIVpnConnectionClient) GetNetwork(id string) (*models.NetworkIDs, error) { params := p_cloud_v_p_n_connections.NewPcloudVpnconnectionsNetworksGetParams(). WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithVpnConnectionID(id) - resp, err := f.session.Power.PCloudVPNConnections.PcloudVpnconnectionsNetworksGet(params, f.authInfo) + resp, err := f.session.Power.PCloudvpnConnections.PcloudVpnconnectionsNetworksGet(params, f.authInfo) if err != nil { return nil, fmt.Errorf("failed to Get Networks for VPN Connection %s: %w", id, err) } @@ -121,7 +121,7 @@ func (f *IBMPIVpnConnectionClient) AddNetwork(id, networkID string) (*models.Job WithContext(f.ctx).WithTimeout(helpers.PIUpdateTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithVpnConnectionID(id). WithBody(&models.NetworkID{NetworkID: &networkID}) - resp, err := f.session.Power.PCloudVPNConnections.PcloudVpnconnectionsNetworksPut(params, f.authInfo) + resp, err := f.session.Power.PCloudvpnConnections.PcloudVpnconnectionsNetworksPut(params, f.authInfo) if err != nil { return nil, fmt.Errorf("failed to Add Network %s to VPN Connection %s: %w", networkID, id, err) } @@ -137,7 +137,7 @@ func (f *IBMPIVpnConnectionClient) DeleteNetwork(id, networkID string) (*models. WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithVpnConnectionID(id). WithBody(&models.NetworkID{NetworkID: &networkID}) - resp, err := f.session.Power.PCloudVPNConnections.PcloudVpnconnectionsNetworksDelete(params, f.authInfo) + resp, err := f.session.Power.PCloudvpnConnections.PcloudVpnconnectionsNetworksDelete(params, f.authInfo) if err != nil { return nil, fmt.Errorf("failed to Delete Network %s from VPN Connection %s: %w", networkID, id, err) } @@ -152,7 +152,7 @@ func (f *IBMPIVpnConnectionClient) GetSubnet(id string) (*models.PeerSubnets, er params := p_cloud_v_p_n_connections.NewPcloudVpnconnectionsPeersubnetsGetParams(). WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithVpnConnectionID(id) - resp, err := f.session.Power.PCloudVPNConnections.PcloudVpnconnectionsPeersubnetsGet(params, f.authInfo) + resp, err := f.session.Power.PCloudvpnConnections.PcloudVpnconnectionsPeersubnetsGet(params, f.authInfo) if err != nil { return nil, fmt.Errorf("failed to Get Subnets from VPN Connection %s: %w", id, err) } @@ -168,7 +168,7 @@ func (f *IBMPIVpnConnectionClient) AddSubnet(id, subnet string) (*models.PeerSub WithContext(f.ctx).WithTimeout(helpers.PIUpdateTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithVpnConnectionID(id). WithBody(&models.PeerSubnetUpdate{Cidr: &subnet}) - resp, err := f.session.Power.PCloudVPNConnections.PcloudVpnconnectionsPeersubnetsPut(params, f.authInfo) + resp, err := f.session.Power.PCloudvpnConnections.PcloudVpnconnectionsPeersubnetsPut(params, f.authInfo) if err != nil { return nil, fmt.Errorf("failed to Add Subnets to VPN Connection %s: %w", id, err) } @@ -184,7 +184,7 @@ func (f *IBMPIVpnConnectionClient) DeleteSubnet(id, subnet string) (*models.Peer WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithVpnConnectionID(id). WithBody(&models.PeerSubnetUpdate{Cidr: &subnet}) - resp, err := f.session.Power.PCloudVPNConnections.PcloudVpnconnectionsPeersubnetsDelete(params, f.authInfo) + resp, err := f.session.Power.PCloudvpnConnections.PcloudVpnconnectionsPeersubnetsDelete(params, f.authInfo) if err != nil { return nil, fmt.Errorf("failed to Delete Subnet from VPN Connection %s: %w", id, err) } diff --git a/examples/instance/main.go b/examples/instance/main.go index 4eb42cbf..523ed7e9 100644 --- a/examples/instance/main.go +++ b/examples/instance/main.go @@ -44,9 +44,9 @@ func main() { body := &models.PVMInstanceCreate{ ImageID: &imageID, KeyPairName: "test-key", - NetworkIds: networks, + NetworkIDs: networks, ServerName: &name, - VolumeIds: volumes, + VolumeIDs: volumes, Memory: &memory, Processors: &processors, ProcType: &procType, diff --git a/examples/vpn/main.go b/examples/vpn/main.go index d83055e0..65db16f3 100644 --- a/examples/vpn/main.go +++ b/examples/vpn/main.go @@ -53,10 +53,11 @@ func main() { var dhGroup, version int64 = 1, 1 encryption := "3des-cbc" presharedKey := "sample" + keyLifeTime := models.KeyLifetime(180) bodyike := &models.IKEPolicyCreate{ DhGroup: &dhGroup, Encryption: &encryption, - KeyLifetime: models.KeyLifetime(180), + KeyLifetime: &keyLifeTime, Name: &ikePolicyName, PresharedKey: &presharedKey, Version: &version, @@ -76,10 +77,10 @@ func main() { // Create and Get IPSec Policy pfs := false bodyipsec := &models.IPSecPolicyCreate{ - Authentication: models.IPSECPolicyAuthenticationHmacMd596, + Authentication: models.IPSECPolicyAuthenticationHmacDashMd5Dash96, DhGroup: &dhGroup, Encryption: &encryption, - KeyLifetime: models.KeyLifetime(180), + KeyLifetime: &keyLifeTime, Name: &ipsecPolicyName, Pfs: &pfs, } @@ -97,13 +98,14 @@ func main() { // Create and Get VPN Connection mode := "policy" + pga := models.PeerGatewayAddress("1.1.1.1") body := &models.VPNConnectionCreate{ IkePolicy: ikePolicy.ID, IPSecPolicy: ipsecPolicy.ID, Mode: &mode, Name: &name, Networks: networks, - PeerGatewayAddress: "1.1.1.1", + PeerGatewayAddress: &pga, PeerSubnets: []string{"128.0.111.0/24"}, } createResp, err := vpnClient.Create(body) diff --git a/ibmpisession/ibmpowersession.go b/ibmpisession/ibmpowersession.go index 5972c342..0d2150b8 100644 --- a/ibmpisession/ibmpowersession.go +++ b/ibmpisession/ibmpowersession.go @@ -30,7 +30,7 @@ import ( type IBMPISession struct { IAMToken string IMSToken string - Power *client.PowerIaas + Power *client.PowerIaasAPI UserAccount string Region string Zone string diff --git a/power/client/authentication/authentication_client.go b/power/client/authentication/authentication_client.go index d55f6b5f..2e9c3f96 100644 --- a/power/client/authentication/authentication_client.go +++ b/power/client/authentication/authentication_client.go @@ -6,13 +6,14 @@ package authentication // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/runtime" + "fmt" - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" ) // New creates a new authentication API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { return &Client{transport: transport, formats: formats} } @@ -24,16 +25,43 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + ServiceBrokerAuthCallback(params *ServiceBrokerAuthCallbackParams, opts ...ClientOption) (*ServiceBrokerAuthCallbackOK, error) + + ServiceBrokerAuthDeviceCodePost(params *ServiceBrokerAuthDeviceCodePostParams, opts ...ClientOption) (*ServiceBrokerAuthDeviceCodePostOK, error) + + ServiceBrokerAuthDeviceTokenPost(params *ServiceBrokerAuthDeviceTokenPostParams, opts ...ClientOption) (*ServiceBrokerAuthDeviceTokenPostOK, error) + + ServiceBrokerAuthInfoToken(params *ServiceBrokerAuthInfoTokenParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerAuthInfoTokenOK, error) + + ServiceBrokerAuthInfoUser(params *ServiceBrokerAuthInfoUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerAuthInfoUserOK, error) + + ServiceBrokerAuthLogin(params *ServiceBrokerAuthLoginParams, opts ...ClientOption) (*ServiceBrokerAuthLoginOK, error) + + ServiceBrokerAuthLogout(params *ServiceBrokerAuthLogoutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerAuthLogoutOK, error) + + ServiceBrokerAuthRegistration(params *ServiceBrokerAuthRegistrationParams, opts ...ClientOption) (*ServiceBrokerAuthRegistrationOK, error) + + ServiceBrokerAuthRegistrationCallback(params *ServiceBrokerAuthRegistrationCallbackParams, opts ...ClientOption) (*ServiceBrokerAuthRegistrationCallbackOK, error) + + ServiceBrokerAuthTokenPost(params *ServiceBrokerAuthTokenPostParams, opts ...ClientOption) (*ServiceBrokerAuthTokenPostOK, error) + + SetTransport(transport runtime.ClientTransport) +} + /* -ServiceBrokerAuthCallback returns an access token and set cookie + ServiceBrokerAuthCallback returns an access token and set cookie */ -func (a *Client) ServiceBrokerAuthCallback(params *ServiceBrokerAuthCallbackParams) (*ServiceBrokerAuthCallbackOK, error) { +func (a *Client) ServiceBrokerAuthCallback(params *ServiceBrokerAuthCallbackParams, opts ...ClientOption) (*ServiceBrokerAuthCallbackOK, error) { // TODO: Validate the params before sending if params == nil { params = NewServiceBrokerAuthCallbackParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "serviceBroker.auth.callback", Method: "GET", PathPattern: "/auth/v1/callback", @@ -44,24 +72,34 @@ func (a *Client) ServiceBrokerAuthCallback(params *ServiceBrokerAuthCallbackPara Reader: &ServiceBrokerAuthCallbackReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*ServiceBrokerAuthCallbackOK), nil - + success, ok := result.(*ServiceBrokerAuthCallbackOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for serviceBroker.auth.callback: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -ServiceBrokerAuthDeviceCodePost requests a authorization device code + ServiceBrokerAuthDeviceCodePost requests a authorization device code */ -func (a *Client) ServiceBrokerAuthDeviceCodePost(params *ServiceBrokerAuthDeviceCodePostParams) (*ServiceBrokerAuthDeviceCodePostOK, error) { +func (a *Client) ServiceBrokerAuthDeviceCodePost(params *ServiceBrokerAuthDeviceCodePostParams, opts ...ClientOption) (*ServiceBrokerAuthDeviceCodePostOK, error) { // TODO: Validate the params before sending if params == nil { params = NewServiceBrokerAuthDeviceCodePostParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "serviceBroker.auth.device.code.post", Method: "POST", PathPattern: "/auth/v1/device/code", @@ -72,24 +110,34 @@ func (a *Client) ServiceBrokerAuthDeviceCodePost(params *ServiceBrokerAuthDevice Reader: &ServiceBrokerAuthDeviceCodePostReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*ServiceBrokerAuthDeviceCodePostOK), nil - + success, ok := result.(*ServiceBrokerAuthDeviceCodePostOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for serviceBroker.auth.device.code.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -ServiceBrokerAuthDeviceTokenPost polls for authorization device token + ServiceBrokerAuthDeviceTokenPost polls for authorization device token */ -func (a *Client) ServiceBrokerAuthDeviceTokenPost(params *ServiceBrokerAuthDeviceTokenPostParams) (*ServiceBrokerAuthDeviceTokenPostOK, error) { +func (a *Client) ServiceBrokerAuthDeviceTokenPost(params *ServiceBrokerAuthDeviceTokenPostParams, opts ...ClientOption) (*ServiceBrokerAuthDeviceTokenPostOK, error) { // TODO: Validate the params before sending if params == nil { params = NewServiceBrokerAuthDeviceTokenPostParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "serviceBroker.auth.device.token.post", Method: "POST", PathPattern: "/auth/v1/device/token", @@ -100,24 +148,34 @@ func (a *Client) ServiceBrokerAuthDeviceTokenPost(params *ServiceBrokerAuthDevic Reader: &ServiceBrokerAuthDeviceTokenPostReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*ServiceBrokerAuthDeviceTokenPostOK), nil - + success, ok := result.(*ServiceBrokerAuthDeviceTokenPostOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for serviceBroker.auth.device.token.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -ServiceBrokerAuthInfoToken information about current access token + ServiceBrokerAuthInfoToken information about current access token */ -func (a *Client) ServiceBrokerAuthInfoToken(params *ServiceBrokerAuthInfoTokenParams, authInfo runtime.ClientAuthInfoWriter) (*ServiceBrokerAuthInfoTokenOK, error) { +func (a *Client) ServiceBrokerAuthInfoToken(params *ServiceBrokerAuthInfoTokenParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerAuthInfoTokenOK, error) { // TODO: Validate the params before sending if params == nil { params = NewServiceBrokerAuthInfoTokenParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "serviceBroker.auth.info.token", Method: "GET", PathPattern: "/auth/v1/info/token", @@ -129,24 +187,34 @@ func (a *Client) ServiceBrokerAuthInfoToken(params *ServiceBrokerAuthInfoTokenPa AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*ServiceBrokerAuthInfoTokenOK), nil - + success, ok := result.(*ServiceBrokerAuthInfoTokenOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for serviceBroker.auth.info.token: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -ServiceBrokerAuthInfoUser information about current user + ServiceBrokerAuthInfoUser information about current user */ -func (a *Client) ServiceBrokerAuthInfoUser(params *ServiceBrokerAuthInfoUserParams, authInfo runtime.ClientAuthInfoWriter) (*ServiceBrokerAuthInfoUserOK, error) { +func (a *Client) ServiceBrokerAuthInfoUser(params *ServiceBrokerAuthInfoUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerAuthInfoUserOK, error) { // TODO: Validate the params before sending if params == nil { params = NewServiceBrokerAuthInfoUserParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "serviceBroker.auth.info.user", Method: "GET", PathPattern: "/auth/v1/info/user", @@ -158,24 +226,34 @@ func (a *Client) ServiceBrokerAuthInfoUser(params *ServiceBrokerAuthInfoUserPara AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*ServiceBrokerAuthInfoUserOK), nil - + success, ok := result.(*ServiceBrokerAuthInfoUserOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for serviceBroker.auth.info.user: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -ServiceBrokerAuthLogin logins + ServiceBrokerAuthLogin logins */ -func (a *Client) ServiceBrokerAuthLogin(params *ServiceBrokerAuthLoginParams) (*ServiceBrokerAuthLoginOK, error) { +func (a *Client) ServiceBrokerAuthLogin(params *ServiceBrokerAuthLoginParams, opts ...ClientOption) (*ServiceBrokerAuthLoginOK, error) { // TODO: Validate the params before sending if params == nil { params = NewServiceBrokerAuthLoginParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "serviceBroker.auth.login", Method: "GET", PathPattern: "/auth/v1/login", @@ -186,24 +264,34 @@ func (a *Client) ServiceBrokerAuthLogin(params *ServiceBrokerAuthLoginParams) (* Reader: &ServiceBrokerAuthLoginReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*ServiceBrokerAuthLoginOK), nil - + success, ok := result.(*ServiceBrokerAuthLoginOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for serviceBroker.auth.login: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -ServiceBrokerAuthLogout logouts + ServiceBrokerAuthLogout logouts */ -func (a *Client) ServiceBrokerAuthLogout(params *ServiceBrokerAuthLogoutParams, authInfo runtime.ClientAuthInfoWriter) (*ServiceBrokerAuthLogoutOK, error) { +func (a *Client) ServiceBrokerAuthLogout(params *ServiceBrokerAuthLogoutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerAuthLogoutOK, error) { // TODO: Validate the params before sending if params == nil { params = NewServiceBrokerAuthLogoutParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "serviceBroker.auth.logout", Method: "GET", PathPattern: "/auth/v1/logout", @@ -215,24 +303,34 @@ func (a *Client) ServiceBrokerAuthLogout(params *ServiceBrokerAuthLogoutParams, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*ServiceBrokerAuthLogoutOK), nil - + success, ok := result.(*ServiceBrokerAuthLogoutOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for serviceBroker.auth.logout: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -ServiceBrokerAuthRegistration registrations of a new tenant and login + ServiceBrokerAuthRegistration registrations of a new tenant and login */ -func (a *Client) ServiceBrokerAuthRegistration(params *ServiceBrokerAuthRegistrationParams) (*ServiceBrokerAuthRegistrationOK, error) { +func (a *Client) ServiceBrokerAuthRegistration(params *ServiceBrokerAuthRegistrationParams, opts ...ClientOption) (*ServiceBrokerAuthRegistrationOK, error) { // TODO: Validate the params before sending if params == nil { params = NewServiceBrokerAuthRegistrationParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "serviceBroker.auth.registration", Method: "GET", PathPattern: "/auth/v1/registration", @@ -243,24 +341,34 @@ func (a *Client) ServiceBrokerAuthRegistration(params *ServiceBrokerAuthRegistra Reader: &ServiceBrokerAuthRegistrationReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*ServiceBrokerAuthRegistrationOK), nil - + success, ok := result.(*ServiceBrokerAuthRegistrationOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for serviceBroker.auth.registration: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -ServiceBrokerAuthRegistrationCallback associates the user with a tenant and returns an access token + ServiceBrokerAuthRegistrationCallback associates the user with a tenant and returns an access token */ -func (a *Client) ServiceBrokerAuthRegistrationCallback(params *ServiceBrokerAuthRegistrationCallbackParams) (*ServiceBrokerAuthRegistrationCallbackOK, error) { +func (a *Client) ServiceBrokerAuthRegistrationCallback(params *ServiceBrokerAuthRegistrationCallbackParams, opts ...ClientOption) (*ServiceBrokerAuthRegistrationCallbackOK, error) { // TODO: Validate the params before sending if params == nil { params = NewServiceBrokerAuthRegistrationCallbackParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "serviceBroker.auth.registration.callback", Method: "GET", PathPattern: "/auth/v1/callback-registration", @@ -271,24 +379,34 @@ func (a *Client) ServiceBrokerAuthRegistrationCallback(params *ServiceBrokerAuth Reader: &ServiceBrokerAuthRegistrationCallbackReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*ServiceBrokerAuthRegistrationCallbackOK), nil - + success, ok := result.(*ServiceBrokerAuthRegistrationCallbackOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for serviceBroker.auth.registration.callback: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -ServiceBrokerAuthTokenPost requests a new token from a refresh token + ServiceBrokerAuthTokenPost requests a new token from a refresh token */ -func (a *Client) ServiceBrokerAuthTokenPost(params *ServiceBrokerAuthTokenPostParams) (*ServiceBrokerAuthTokenPostOK, error) { +func (a *Client) ServiceBrokerAuthTokenPost(params *ServiceBrokerAuthTokenPostParams, opts ...ClientOption) (*ServiceBrokerAuthTokenPostOK, error) { // TODO: Validate the params before sending if params == nil { params = NewServiceBrokerAuthTokenPostParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "serviceBroker.auth.token.post", Method: "POST", PathPattern: "/auth/v1/token", @@ -299,12 +417,23 @@ func (a *Client) ServiceBrokerAuthTokenPost(params *ServiceBrokerAuthTokenPostPa Reader: &ServiceBrokerAuthTokenPostReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*ServiceBrokerAuthTokenPostOK), nil - + success, ok := result.(*ServiceBrokerAuthTokenPostOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for serviceBroker.auth.token.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } // SetTransport changes the transport on the client diff --git a/power/client/authentication/service_broker_auth_callback_parameters.go b/power/client/authentication/service_broker_auth_callback_parameters.go index 01246a8f..7c2aaa3c 100644 --- a/power/client/authentication/service_broker_auth_callback_parameters.go +++ b/power/client/authentication/service_broker_auth_callback_parameters.go @@ -13,51 +13,49 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewServiceBrokerAuthCallbackParams creates a new ServiceBrokerAuthCallbackParams object -// with the default values initialized. +// NewServiceBrokerAuthCallbackParams creates a new ServiceBrokerAuthCallbackParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewServiceBrokerAuthCallbackParams() *ServiceBrokerAuthCallbackParams { - return &ServiceBrokerAuthCallbackParams{ - timeout: cr.DefaultTimeout, } } // NewServiceBrokerAuthCallbackParamsWithTimeout creates a new ServiceBrokerAuthCallbackParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewServiceBrokerAuthCallbackParamsWithTimeout(timeout time.Duration) *ServiceBrokerAuthCallbackParams { - return &ServiceBrokerAuthCallbackParams{ - timeout: timeout, } } // NewServiceBrokerAuthCallbackParamsWithContext creates a new ServiceBrokerAuthCallbackParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewServiceBrokerAuthCallbackParamsWithContext(ctx context.Context) *ServiceBrokerAuthCallbackParams { - return &ServiceBrokerAuthCallbackParams{ - Context: ctx, } } // NewServiceBrokerAuthCallbackParamsWithHTTPClient creates a new ServiceBrokerAuthCallbackParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewServiceBrokerAuthCallbackParamsWithHTTPClient(client *http.Client) *ServiceBrokerAuthCallbackParams { - return &ServiceBrokerAuthCallbackParams{ HTTPClient: client, } } -/*ServiceBrokerAuthCallbackParams contains all the parameters to send to the API endpoint -for the service broker auth callback operation typically these are written to a http.Request +/* ServiceBrokerAuthCallbackParams contains all the parameters to send to the API endpoint + for the service broker auth callback operation. + + Typically these are written to a http.Request. */ type ServiceBrokerAuthCallbackParams struct { timeout time.Duration @@ -65,6 +63,21 @@ type ServiceBrokerAuthCallbackParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the service broker auth callback params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthCallbackParams) WithDefaults() *ServiceBrokerAuthCallbackParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker auth callback params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthCallbackParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the service broker auth callback params func (o *ServiceBrokerAuthCallbackParams) WithTimeout(timeout time.Duration) *ServiceBrokerAuthCallbackParams { o.SetTimeout(timeout) diff --git a/power/client/authentication/service_broker_auth_callback_responses.go b/power/client/authentication/service_broker_auth_callback_responses.go index 5142d635..b48acc24 100644 --- a/power/client/authentication/service_broker_auth_callback_responses.go +++ b/power/client/authentication/service_broker_auth_callback_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // ServiceBrokerAuthCallbackReader is a Reader for the ServiceBrokerAuthCallback structure. @@ -24,30 +23,26 @@ type ServiceBrokerAuthCallbackReader struct { // ReadResponse reads a server response into the received o. func (o *ServiceBrokerAuthCallbackReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewServiceBrokerAuthCallbackOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 401: result := NewServiceBrokerAuthCallbackUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewServiceBrokerAuthCallbackInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -56,7 +51,7 @@ func NewServiceBrokerAuthCallbackOK() *ServiceBrokerAuthCallbackOK { return &ServiceBrokerAuthCallbackOK{} } -/*ServiceBrokerAuthCallbackOK handles this case with default header values. +/* ServiceBrokerAuthCallbackOK describes a response with status code 200, with default header values. OK */ @@ -67,6 +62,9 @@ type ServiceBrokerAuthCallbackOK struct { func (o *ServiceBrokerAuthCallbackOK) Error() string { return fmt.Sprintf("[GET /auth/v1/callback][%d] serviceBrokerAuthCallbackOK %+v", 200, o.Payload) } +func (o *ServiceBrokerAuthCallbackOK) GetPayload() *models.AccessToken { + return o.Payload +} func (o *ServiceBrokerAuthCallbackOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -85,7 +83,7 @@ func NewServiceBrokerAuthCallbackUnauthorized() *ServiceBrokerAuthCallbackUnauth return &ServiceBrokerAuthCallbackUnauthorized{} } -/*ServiceBrokerAuthCallbackUnauthorized handles this case with default header values. +/* ServiceBrokerAuthCallbackUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -96,6 +94,9 @@ type ServiceBrokerAuthCallbackUnauthorized struct { func (o *ServiceBrokerAuthCallbackUnauthorized) Error() string { return fmt.Sprintf("[GET /auth/v1/callback][%d] serviceBrokerAuthCallbackUnauthorized %+v", 401, o.Payload) } +func (o *ServiceBrokerAuthCallbackUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerAuthCallbackUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -114,7 +115,7 @@ func NewServiceBrokerAuthCallbackInternalServerError() *ServiceBrokerAuthCallbac return &ServiceBrokerAuthCallbackInternalServerError{} } -/*ServiceBrokerAuthCallbackInternalServerError handles this case with default header values. +/* ServiceBrokerAuthCallbackInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -125,6 +126,9 @@ type ServiceBrokerAuthCallbackInternalServerError struct { func (o *ServiceBrokerAuthCallbackInternalServerError) Error() string { return fmt.Sprintf("[GET /auth/v1/callback][%d] serviceBrokerAuthCallbackInternalServerError %+v", 500, o.Payload) } +func (o *ServiceBrokerAuthCallbackInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerAuthCallbackInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/authentication/service_broker_auth_device_code_post_parameters.go b/power/client/authentication/service_broker_auth_device_code_post_parameters.go index e58444e8..ad621b60 100644 --- a/power/client/authentication/service_broker_auth_device_code_post_parameters.go +++ b/power/client/authentication/service_broker_auth_device_code_post_parameters.go @@ -13,51 +13,49 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewServiceBrokerAuthDeviceCodePostParams creates a new ServiceBrokerAuthDeviceCodePostParams object -// with the default values initialized. +// NewServiceBrokerAuthDeviceCodePostParams creates a new ServiceBrokerAuthDeviceCodePostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewServiceBrokerAuthDeviceCodePostParams() *ServiceBrokerAuthDeviceCodePostParams { - return &ServiceBrokerAuthDeviceCodePostParams{ - timeout: cr.DefaultTimeout, } } // NewServiceBrokerAuthDeviceCodePostParamsWithTimeout creates a new ServiceBrokerAuthDeviceCodePostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewServiceBrokerAuthDeviceCodePostParamsWithTimeout(timeout time.Duration) *ServiceBrokerAuthDeviceCodePostParams { - return &ServiceBrokerAuthDeviceCodePostParams{ - timeout: timeout, } } // NewServiceBrokerAuthDeviceCodePostParamsWithContext creates a new ServiceBrokerAuthDeviceCodePostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewServiceBrokerAuthDeviceCodePostParamsWithContext(ctx context.Context) *ServiceBrokerAuthDeviceCodePostParams { - return &ServiceBrokerAuthDeviceCodePostParams{ - Context: ctx, } } // NewServiceBrokerAuthDeviceCodePostParamsWithHTTPClient creates a new ServiceBrokerAuthDeviceCodePostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewServiceBrokerAuthDeviceCodePostParamsWithHTTPClient(client *http.Client) *ServiceBrokerAuthDeviceCodePostParams { - return &ServiceBrokerAuthDeviceCodePostParams{ HTTPClient: client, } } -/*ServiceBrokerAuthDeviceCodePostParams contains all the parameters to send to the API endpoint -for the service broker auth device code post operation typically these are written to a http.Request +/* ServiceBrokerAuthDeviceCodePostParams contains all the parameters to send to the API endpoint + for the service broker auth device code post operation. + + Typically these are written to a http.Request. */ type ServiceBrokerAuthDeviceCodePostParams struct { timeout time.Duration @@ -65,6 +63,21 @@ type ServiceBrokerAuthDeviceCodePostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the service broker auth device code post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthDeviceCodePostParams) WithDefaults() *ServiceBrokerAuthDeviceCodePostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker auth device code post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthDeviceCodePostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the service broker auth device code post params func (o *ServiceBrokerAuthDeviceCodePostParams) WithTimeout(timeout time.Duration) *ServiceBrokerAuthDeviceCodePostParams { o.SetTimeout(timeout) diff --git a/power/client/authentication/service_broker_auth_device_code_post_responses.go b/power/client/authentication/service_broker_auth_device_code_post_responses.go index b16dc9de..b0d31f0b 100644 --- a/power/client/authentication/service_broker_auth_device_code_post_responses.go +++ b/power/client/authentication/service_broker_auth_device_code_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // ServiceBrokerAuthDeviceCodePostReader is a Reader for the ServiceBrokerAuthDeviceCodePost structure. @@ -24,30 +23,26 @@ type ServiceBrokerAuthDeviceCodePostReader struct { // ReadResponse reads a server response into the received o. func (o *ServiceBrokerAuthDeviceCodePostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewServiceBrokerAuthDeviceCodePostOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 403: result := NewServiceBrokerAuthDeviceCodePostForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewServiceBrokerAuthDeviceCodePostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -56,7 +51,7 @@ func NewServiceBrokerAuthDeviceCodePostOK() *ServiceBrokerAuthDeviceCodePostOK { return &ServiceBrokerAuthDeviceCodePostOK{} } -/*ServiceBrokerAuthDeviceCodePostOK handles this case with default header values. +/* ServiceBrokerAuthDeviceCodePostOK describes a response with status code 200, with default header values. OK */ @@ -67,6 +62,9 @@ type ServiceBrokerAuthDeviceCodePostOK struct { func (o *ServiceBrokerAuthDeviceCodePostOK) Error() string { return fmt.Sprintf("[POST /auth/v1/device/code][%d] serviceBrokerAuthDeviceCodePostOK %+v", 200, o.Payload) } +func (o *ServiceBrokerAuthDeviceCodePostOK) GetPayload() *models.DeviceCode { + return o.Payload +} func (o *ServiceBrokerAuthDeviceCodePostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -85,7 +83,7 @@ func NewServiceBrokerAuthDeviceCodePostForbidden() *ServiceBrokerAuthDeviceCodeP return &ServiceBrokerAuthDeviceCodePostForbidden{} } -/*ServiceBrokerAuthDeviceCodePostForbidden handles this case with default header values. +/* ServiceBrokerAuthDeviceCodePostForbidden describes a response with status code 403, with default header values. Quota exceeded */ @@ -96,6 +94,9 @@ type ServiceBrokerAuthDeviceCodePostForbidden struct { func (o *ServiceBrokerAuthDeviceCodePostForbidden) Error() string { return fmt.Sprintf("[POST /auth/v1/device/code][%d] serviceBrokerAuthDeviceCodePostForbidden %+v", 403, o.Payload) } +func (o *ServiceBrokerAuthDeviceCodePostForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerAuthDeviceCodePostForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -114,7 +115,7 @@ func NewServiceBrokerAuthDeviceCodePostInternalServerError() *ServiceBrokerAuthD return &ServiceBrokerAuthDeviceCodePostInternalServerError{} } -/*ServiceBrokerAuthDeviceCodePostInternalServerError handles this case with default header values. +/* ServiceBrokerAuthDeviceCodePostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -125,6 +126,9 @@ type ServiceBrokerAuthDeviceCodePostInternalServerError struct { func (o *ServiceBrokerAuthDeviceCodePostInternalServerError) Error() string { return fmt.Sprintf("[POST /auth/v1/device/code][%d] serviceBrokerAuthDeviceCodePostInternalServerError %+v", 500, o.Payload) } +func (o *ServiceBrokerAuthDeviceCodePostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerAuthDeviceCodePostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/authentication/service_broker_auth_device_token_post_parameters.go b/power/client/authentication/service_broker_auth_device_token_post_parameters.go index c8dce41e..ab928c9a 100644 --- a/power/client/authentication/service_broker_auth_device_token_post_parameters.go +++ b/power/client/authentication/service_broker_auth_device_token_post_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewServiceBrokerAuthDeviceTokenPostParams creates a new ServiceBrokerAuthDeviceTokenPostParams object -// with the default values initialized. +// NewServiceBrokerAuthDeviceTokenPostParams creates a new ServiceBrokerAuthDeviceTokenPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewServiceBrokerAuthDeviceTokenPostParams() *ServiceBrokerAuthDeviceTokenPostParams { - var () return &ServiceBrokerAuthDeviceTokenPostParams{ - timeout: cr.DefaultTimeout, } } // NewServiceBrokerAuthDeviceTokenPostParamsWithTimeout creates a new ServiceBrokerAuthDeviceTokenPostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewServiceBrokerAuthDeviceTokenPostParamsWithTimeout(timeout time.Duration) *ServiceBrokerAuthDeviceTokenPostParams { - var () return &ServiceBrokerAuthDeviceTokenPostParams{ - timeout: timeout, } } // NewServiceBrokerAuthDeviceTokenPostParamsWithContext creates a new ServiceBrokerAuthDeviceTokenPostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewServiceBrokerAuthDeviceTokenPostParamsWithContext(ctx context.Context) *ServiceBrokerAuthDeviceTokenPostParams { - var () return &ServiceBrokerAuthDeviceTokenPostParams{ - Context: ctx, } } // NewServiceBrokerAuthDeviceTokenPostParamsWithHTTPClient creates a new ServiceBrokerAuthDeviceTokenPostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewServiceBrokerAuthDeviceTokenPostParamsWithHTTPClient(client *http.Client) *ServiceBrokerAuthDeviceTokenPostParams { - var () return &ServiceBrokerAuthDeviceTokenPostParams{ HTTPClient: client, } } -/*ServiceBrokerAuthDeviceTokenPostParams contains all the parameters to send to the API endpoint -for the service broker auth device token post operation typically these are written to a http.Request +/* ServiceBrokerAuthDeviceTokenPostParams contains all the parameters to send to the API endpoint + for the service broker auth device token post operation. + + Typically these are written to a http.Request. */ type ServiceBrokerAuthDeviceTokenPostParams struct { - /*Body - Parameters for polling authorization device code + /* Body. + Parameters for polling authorization device code */ Body ServiceBrokerAuthDeviceTokenPostBody @@ -72,6 +70,21 @@ type ServiceBrokerAuthDeviceTokenPostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the service broker auth device token post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthDeviceTokenPostParams) WithDefaults() *ServiceBrokerAuthDeviceTokenPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker auth device token post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthDeviceTokenPostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the service broker auth device token post params func (o *ServiceBrokerAuthDeviceTokenPostParams) WithTimeout(timeout time.Duration) *ServiceBrokerAuthDeviceTokenPostParams { o.SetTimeout(timeout) @@ -123,7 +136,6 @@ func (o *ServiceBrokerAuthDeviceTokenPostParams) WriteToRequest(r runtime.Client return err } var res []error - if err := r.SetBodyParam(o.Body); err != nil { return err } diff --git a/power/client/authentication/service_broker_auth_device_token_post_responses.go b/power/client/authentication/service_broker_auth_device_token_post_responses.go index 72c28f8b..f9579f5c 100644 --- a/power/client/authentication/service_broker_auth_device_token_post_responses.go +++ b/power/client/authentication/service_broker_auth_device_token_post_responses.go @@ -6,15 +6,15 @@ package authentication // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "fmt" "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // ServiceBrokerAuthDeviceTokenPostReader is a Reader for the ServiceBrokerAuthDeviceTokenPost structure. @@ -25,44 +25,38 @@ type ServiceBrokerAuthDeviceTokenPostReader struct { // ReadResponse reads a server response into the received o. func (o *ServiceBrokerAuthDeviceTokenPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewServiceBrokerAuthDeviceTokenPostOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewServiceBrokerAuthDeviceTokenPostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 403: result := NewServiceBrokerAuthDeviceTokenPostForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 429: result := NewServiceBrokerAuthDeviceTokenPostTooManyRequests() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewServiceBrokerAuthDeviceTokenPostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -71,7 +65,7 @@ func NewServiceBrokerAuthDeviceTokenPostOK() *ServiceBrokerAuthDeviceTokenPostOK return &ServiceBrokerAuthDeviceTokenPostOK{} } -/*ServiceBrokerAuthDeviceTokenPostOK handles this case with default header values. +/* ServiceBrokerAuthDeviceTokenPostOK describes a response with status code 200, with default header values. OK */ @@ -82,6 +76,9 @@ type ServiceBrokerAuthDeviceTokenPostOK struct { func (o *ServiceBrokerAuthDeviceTokenPostOK) Error() string { return fmt.Sprintf("[POST /auth/v1/device/token][%d] serviceBrokerAuthDeviceTokenPostOK %+v", 200, o.Payload) } +func (o *ServiceBrokerAuthDeviceTokenPostOK) GetPayload() *models.Token { + return o.Payload +} func (o *ServiceBrokerAuthDeviceTokenPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -100,7 +97,7 @@ func NewServiceBrokerAuthDeviceTokenPostBadRequest() *ServiceBrokerAuthDeviceTok return &ServiceBrokerAuthDeviceTokenPostBadRequest{} } -/*ServiceBrokerAuthDeviceTokenPostBadRequest handles this case with default header values. +/* ServiceBrokerAuthDeviceTokenPostBadRequest describes a response with status code 400, with default header values. Authorization pending */ @@ -111,6 +108,9 @@ type ServiceBrokerAuthDeviceTokenPostBadRequest struct { func (o *ServiceBrokerAuthDeviceTokenPostBadRequest) Error() string { return fmt.Sprintf("[POST /auth/v1/device/token][%d] serviceBrokerAuthDeviceTokenPostBadRequest %+v", 400, o.Payload) } +func (o *ServiceBrokerAuthDeviceTokenPostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerAuthDeviceTokenPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -129,7 +129,7 @@ func NewServiceBrokerAuthDeviceTokenPostForbidden() *ServiceBrokerAuthDeviceToke return &ServiceBrokerAuthDeviceTokenPostForbidden{} } -/*ServiceBrokerAuthDeviceTokenPostForbidden handles this case with default header values. +/* ServiceBrokerAuthDeviceTokenPostForbidden describes a response with status code 403, with default header values. User refused grant */ @@ -140,6 +140,9 @@ type ServiceBrokerAuthDeviceTokenPostForbidden struct { func (o *ServiceBrokerAuthDeviceTokenPostForbidden) Error() string { return fmt.Sprintf("[POST /auth/v1/device/token][%d] serviceBrokerAuthDeviceTokenPostForbidden %+v", 403, o.Payload) } +func (o *ServiceBrokerAuthDeviceTokenPostForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerAuthDeviceTokenPostForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -158,7 +161,7 @@ func NewServiceBrokerAuthDeviceTokenPostTooManyRequests() *ServiceBrokerAuthDevi return &ServiceBrokerAuthDeviceTokenPostTooManyRequests{} } -/*ServiceBrokerAuthDeviceTokenPostTooManyRequests handles this case with default header values. +/* ServiceBrokerAuthDeviceTokenPostTooManyRequests describes a response with status code 429, with default header values. Polling too frequently */ @@ -169,6 +172,9 @@ type ServiceBrokerAuthDeviceTokenPostTooManyRequests struct { func (o *ServiceBrokerAuthDeviceTokenPostTooManyRequests) Error() string { return fmt.Sprintf("[POST /auth/v1/device/token][%d] serviceBrokerAuthDeviceTokenPostTooManyRequests %+v", 429, o.Payload) } +func (o *ServiceBrokerAuthDeviceTokenPostTooManyRequests) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerAuthDeviceTokenPostTooManyRequests) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -187,7 +193,7 @@ func NewServiceBrokerAuthDeviceTokenPostInternalServerError() *ServiceBrokerAuth return &ServiceBrokerAuthDeviceTokenPostInternalServerError{} } -/*ServiceBrokerAuthDeviceTokenPostInternalServerError handles this case with default header values. +/* ServiceBrokerAuthDeviceTokenPostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -198,6 +204,9 @@ type ServiceBrokerAuthDeviceTokenPostInternalServerError struct { func (o *ServiceBrokerAuthDeviceTokenPostInternalServerError) Error() string { return fmt.Sprintf("[POST /auth/v1/device/token][%d] serviceBrokerAuthDeviceTokenPostInternalServerError %+v", 500, o.Payload) } +func (o *ServiceBrokerAuthDeviceTokenPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerAuthDeviceTokenPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -225,6 +234,11 @@ func (o *ServiceBrokerAuthDeviceTokenPostBody) Validate(formats strfmt.Registry) return nil } +// ContextValidate validates this service broker auth device token post body based on context it is used +func (o *ServiceBrokerAuthDeviceTokenPostBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (o *ServiceBrokerAuthDeviceTokenPostBody) MarshalBinary() ([]byte, error) { if o == nil { diff --git a/power/client/authentication/service_broker_auth_info_token_parameters.go b/power/client/authentication/service_broker_auth_info_token_parameters.go index 95609b0f..8bd091b8 100644 --- a/power/client/authentication/service_broker_auth_info_token_parameters.go +++ b/power/client/authentication/service_broker_auth_info_token_parameters.go @@ -13,51 +13,49 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewServiceBrokerAuthInfoTokenParams creates a new ServiceBrokerAuthInfoTokenParams object -// with the default values initialized. +// NewServiceBrokerAuthInfoTokenParams creates a new ServiceBrokerAuthInfoTokenParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewServiceBrokerAuthInfoTokenParams() *ServiceBrokerAuthInfoTokenParams { - return &ServiceBrokerAuthInfoTokenParams{ - timeout: cr.DefaultTimeout, } } // NewServiceBrokerAuthInfoTokenParamsWithTimeout creates a new ServiceBrokerAuthInfoTokenParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewServiceBrokerAuthInfoTokenParamsWithTimeout(timeout time.Duration) *ServiceBrokerAuthInfoTokenParams { - return &ServiceBrokerAuthInfoTokenParams{ - timeout: timeout, } } // NewServiceBrokerAuthInfoTokenParamsWithContext creates a new ServiceBrokerAuthInfoTokenParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewServiceBrokerAuthInfoTokenParamsWithContext(ctx context.Context) *ServiceBrokerAuthInfoTokenParams { - return &ServiceBrokerAuthInfoTokenParams{ - Context: ctx, } } // NewServiceBrokerAuthInfoTokenParamsWithHTTPClient creates a new ServiceBrokerAuthInfoTokenParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewServiceBrokerAuthInfoTokenParamsWithHTTPClient(client *http.Client) *ServiceBrokerAuthInfoTokenParams { - return &ServiceBrokerAuthInfoTokenParams{ HTTPClient: client, } } -/*ServiceBrokerAuthInfoTokenParams contains all the parameters to send to the API endpoint -for the service broker auth info token operation typically these are written to a http.Request +/* ServiceBrokerAuthInfoTokenParams contains all the parameters to send to the API endpoint + for the service broker auth info token operation. + + Typically these are written to a http.Request. */ type ServiceBrokerAuthInfoTokenParams struct { timeout time.Duration @@ -65,6 +63,21 @@ type ServiceBrokerAuthInfoTokenParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the service broker auth info token params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthInfoTokenParams) WithDefaults() *ServiceBrokerAuthInfoTokenParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker auth info token params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthInfoTokenParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the service broker auth info token params func (o *ServiceBrokerAuthInfoTokenParams) WithTimeout(timeout time.Duration) *ServiceBrokerAuthInfoTokenParams { o.SetTimeout(timeout) diff --git a/power/client/authentication/service_broker_auth_info_token_responses.go b/power/client/authentication/service_broker_auth_info_token_responses.go index 0846f83f..5c38010d 100644 --- a/power/client/authentication/service_broker_auth_info_token_responses.go +++ b/power/client/authentication/service_broker_auth_info_token_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // ServiceBrokerAuthInfoTokenReader is a Reader for the ServiceBrokerAuthInfoToken structure. @@ -24,23 +23,20 @@ type ServiceBrokerAuthInfoTokenReader struct { // ReadResponse reads a server response into the received o. func (o *ServiceBrokerAuthInfoTokenReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewServiceBrokerAuthInfoTokenOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 500: result := NewServiceBrokerAuthInfoTokenInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -49,7 +45,7 @@ func NewServiceBrokerAuthInfoTokenOK() *ServiceBrokerAuthInfoTokenOK { return &ServiceBrokerAuthInfoTokenOK{} } -/*ServiceBrokerAuthInfoTokenOK handles this case with default header values. +/* ServiceBrokerAuthInfoTokenOK describes a response with status code 200, with default header values. OK */ @@ -60,6 +56,9 @@ type ServiceBrokerAuthInfoTokenOK struct { func (o *ServiceBrokerAuthInfoTokenOK) Error() string { return fmt.Sprintf("[GET /auth/v1/info/token][%d] serviceBrokerAuthInfoTokenOK %+v", 200, o.Payload) } +func (o *ServiceBrokerAuthInfoTokenOK) GetPayload() *models.TokenExtra { + return o.Payload +} func (o *ServiceBrokerAuthInfoTokenOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -78,7 +77,7 @@ func NewServiceBrokerAuthInfoTokenInternalServerError() *ServiceBrokerAuthInfoTo return &ServiceBrokerAuthInfoTokenInternalServerError{} } -/*ServiceBrokerAuthInfoTokenInternalServerError handles this case with default header values. +/* ServiceBrokerAuthInfoTokenInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -89,6 +88,9 @@ type ServiceBrokerAuthInfoTokenInternalServerError struct { func (o *ServiceBrokerAuthInfoTokenInternalServerError) Error() string { return fmt.Sprintf("[GET /auth/v1/info/token][%d] serviceBrokerAuthInfoTokenInternalServerError %+v", 500, o.Payload) } +func (o *ServiceBrokerAuthInfoTokenInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerAuthInfoTokenInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/authentication/service_broker_auth_info_user_parameters.go b/power/client/authentication/service_broker_auth_info_user_parameters.go index 166a37ba..400cfced 100644 --- a/power/client/authentication/service_broker_auth_info_user_parameters.go +++ b/power/client/authentication/service_broker_auth_info_user_parameters.go @@ -13,51 +13,49 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewServiceBrokerAuthInfoUserParams creates a new ServiceBrokerAuthInfoUserParams object -// with the default values initialized. +// NewServiceBrokerAuthInfoUserParams creates a new ServiceBrokerAuthInfoUserParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewServiceBrokerAuthInfoUserParams() *ServiceBrokerAuthInfoUserParams { - return &ServiceBrokerAuthInfoUserParams{ - timeout: cr.DefaultTimeout, } } // NewServiceBrokerAuthInfoUserParamsWithTimeout creates a new ServiceBrokerAuthInfoUserParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewServiceBrokerAuthInfoUserParamsWithTimeout(timeout time.Duration) *ServiceBrokerAuthInfoUserParams { - return &ServiceBrokerAuthInfoUserParams{ - timeout: timeout, } } // NewServiceBrokerAuthInfoUserParamsWithContext creates a new ServiceBrokerAuthInfoUserParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewServiceBrokerAuthInfoUserParamsWithContext(ctx context.Context) *ServiceBrokerAuthInfoUserParams { - return &ServiceBrokerAuthInfoUserParams{ - Context: ctx, } } // NewServiceBrokerAuthInfoUserParamsWithHTTPClient creates a new ServiceBrokerAuthInfoUserParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewServiceBrokerAuthInfoUserParamsWithHTTPClient(client *http.Client) *ServiceBrokerAuthInfoUserParams { - return &ServiceBrokerAuthInfoUserParams{ HTTPClient: client, } } -/*ServiceBrokerAuthInfoUserParams contains all the parameters to send to the API endpoint -for the service broker auth info user operation typically these are written to a http.Request +/* ServiceBrokerAuthInfoUserParams contains all the parameters to send to the API endpoint + for the service broker auth info user operation. + + Typically these are written to a http.Request. */ type ServiceBrokerAuthInfoUserParams struct { timeout time.Duration @@ -65,6 +63,21 @@ type ServiceBrokerAuthInfoUserParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the service broker auth info user params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthInfoUserParams) WithDefaults() *ServiceBrokerAuthInfoUserParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker auth info user params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthInfoUserParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the service broker auth info user params func (o *ServiceBrokerAuthInfoUserParams) WithTimeout(timeout time.Duration) *ServiceBrokerAuthInfoUserParams { o.SetTimeout(timeout) diff --git a/power/client/authentication/service_broker_auth_info_user_responses.go b/power/client/authentication/service_broker_auth_info_user_responses.go index 2e474c2a..c8a412df 100644 --- a/power/client/authentication/service_broker_auth_info_user_responses.go +++ b/power/client/authentication/service_broker_auth_info_user_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // ServiceBrokerAuthInfoUserReader is a Reader for the ServiceBrokerAuthInfoUser structure. @@ -24,23 +23,20 @@ type ServiceBrokerAuthInfoUserReader struct { // ReadResponse reads a server response into the received o. func (o *ServiceBrokerAuthInfoUserReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewServiceBrokerAuthInfoUserOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 500: result := NewServiceBrokerAuthInfoUserInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -49,7 +45,7 @@ func NewServiceBrokerAuthInfoUserOK() *ServiceBrokerAuthInfoUserOK { return &ServiceBrokerAuthInfoUserOK{} } -/*ServiceBrokerAuthInfoUserOK handles this case with default header values. +/* ServiceBrokerAuthInfoUserOK describes a response with status code 200, with default header values. OK */ @@ -60,6 +56,9 @@ type ServiceBrokerAuthInfoUserOK struct { func (o *ServiceBrokerAuthInfoUserOK) Error() string { return fmt.Sprintf("[GET /auth/v1/info/user][%d] serviceBrokerAuthInfoUserOK %+v", 200, o.Payload) } +func (o *ServiceBrokerAuthInfoUserOK) GetPayload() *models.UserInfo { + return o.Payload +} func (o *ServiceBrokerAuthInfoUserOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -78,7 +77,7 @@ func NewServiceBrokerAuthInfoUserInternalServerError() *ServiceBrokerAuthInfoUse return &ServiceBrokerAuthInfoUserInternalServerError{} } -/*ServiceBrokerAuthInfoUserInternalServerError handles this case with default header values. +/* ServiceBrokerAuthInfoUserInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -89,6 +88,9 @@ type ServiceBrokerAuthInfoUserInternalServerError struct { func (o *ServiceBrokerAuthInfoUserInternalServerError) Error() string { return fmt.Sprintf("[GET /auth/v1/info/user][%d] serviceBrokerAuthInfoUserInternalServerError %+v", 500, o.Payload) } +func (o *ServiceBrokerAuthInfoUserInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerAuthInfoUserInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/authentication/service_broker_auth_login_parameters.go b/power/client/authentication/service_broker_auth_login_parameters.go index ee6f6cc2..821c5a04 100644 --- a/power/client/authentication/service_broker_auth_login_parameters.go +++ b/power/client/authentication/service_broker_auth_login_parameters.go @@ -13,79 +13,69 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewServiceBrokerAuthLoginParams creates a new ServiceBrokerAuthLoginParams object -// with the default values initialized. +// NewServiceBrokerAuthLoginParams creates a new ServiceBrokerAuthLoginParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewServiceBrokerAuthLoginParams() *ServiceBrokerAuthLoginParams { - var ( - accessTypeDefault = string("online") - ) return &ServiceBrokerAuthLoginParams{ - AccessType: &accessTypeDefault, - timeout: cr.DefaultTimeout, } } // NewServiceBrokerAuthLoginParamsWithTimeout creates a new ServiceBrokerAuthLoginParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewServiceBrokerAuthLoginParamsWithTimeout(timeout time.Duration) *ServiceBrokerAuthLoginParams { - var ( - accessTypeDefault = string("online") - ) return &ServiceBrokerAuthLoginParams{ - AccessType: &accessTypeDefault, - timeout: timeout, } } // NewServiceBrokerAuthLoginParamsWithContext creates a new ServiceBrokerAuthLoginParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewServiceBrokerAuthLoginParamsWithContext(ctx context.Context) *ServiceBrokerAuthLoginParams { - var ( - accessTypeDefault = string("online") - ) return &ServiceBrokerAuthLoginParams{ - AccessType: &accessTypeDefault, - Context: ctx, } } // NewServiceBrokerAuthLoginParamsWithHTTPClient creates a new ServiceBrokerAuthLoginParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewServiceBrokerAuthLoginParamsWithHTTPClient(client *http.Client) *ServiceBrokerAuthLoginParams { - var ( - accessTypeDefault = string("online") - ) return &ServiceBrokerAuthLoginParams{ - AccessType: &accessTypeDefault, HTTPClient: client, } } -/*ServiceBrokerAuthLoginParams contains all the parameters to send to the API endpoint -for the service broker auth login operation typically these are written to a http.Request +/* ServiceBrokerAuthLoginParams contains all the parameters to send to the API endpoint + for the service broker auth login operation. + + Typically these are written to a http.Request. */ type ServiceBrokerAuthLoginParams struct { - /*AccessType - Determines if a refresh token is returned + /* AccessType. + Determines if a refresh token is returned + + Default: "online" */ AccessType *string - /*RedirectURL - The URL to redirect to after login/registration + /* RedirectURL. + + The URL to redirect to after login/registration */ RedirectURL *string - /*UserID - The user id of the user + /* UserID. + + The user id of the user */ UserID *string @@ -94,6 +84,32 @@ type ServiceBrokerAuthLoginParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the service broker auth login params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthLoginParams) WithDefaults() *ServiceBrokerAuthLoginParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker auth login params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthLoginParams) SetDefaults() { + var ( + accessTypeDefault = string("online") + ) + + val := ServiceBrokerAuthLoginParams{ + AccessType: &accessTypeDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + // WithTimeout adds the timeout to the service broker auth login params func (o *ServiceBrokerAuthLoginParams) WithTimeout(timeout time.Duration) *ServiceBrokerAuthLoginParams { o.SetTimeout(timeout) @@ -172,48 +188,51 @@ func (o *ServiceBrokerAuthLoginParams) WriteToRequest(r runtime.ClientRequest, r // query param access_type var qrAccessType string + if o.AccessType != nil { qrAccessType = *o.AccessType } qAccessType := qrAccessType if qAccessType != "" { + if err := r.SetQueryParam("access_type", qAccessType); err != nil { return err } } - } if o.RedirectURL != nil { // query param redirect_url var qrRedirectURL string + if o.RedirectURL != nil { qrRedirectURL = *o.RedirectURL } qRedirectURL := qrRedirectURL if qRedirectURL != "" { + if err := r.SetQueryParam("redirect_url", qRedirectURL); err != nil { return err } } - } if o.UserID != nil { // query param user_id var qrUserID string + if o.UserID != nil { qrUserID = *o.UserID } qUserID := qrUserID if qUserID != "" { + if err := r.SetQueryParam("user_id", qUserID); err != nil { return err } } - } if len(res) > 0 { diff --git a/power/client/authentication/service_broker_auth_login_responses.go b/power/client/authentication/service_broker_auth_login_responses.go index cd304ee0..0372c622 100644 --- a/power/client/authentication/service_broker_auth_login_responses.go +++ b/power/client/authentication/service_broker_auth_login_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // ServiceBrokerAuthLoginReader is a Reader for the ServiceBrokerAuthLogin structure. @@ -24,30 +23,26 @@ type ServiceBrokerAuthLoginReader struct { // ReadResponse reads a server response into the received o. func (o *ServiceBrokerAuthLoginReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewServiceBrokerAuthLoginOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 401: result := NewServiceBrokerAuthLoginUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewServiceBrokerAuthLoginInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -56,7 +51,7 @@ func NewServiceBrokerAuthLoginOK() *ServiceBrokerAuthLoginOK { return &ServiceBrokerAuthLoginOK{} } -/*ServiceBrokerAuthLoginOK handles this case with default header values. +/* ServiceBrokerAuthLoginOK describes a response with status code 200, with default header values. OK */ @@ -67,6 +62,9 @@ type ServiceBrokerAuthLoginOK struct { func (o *ServiceBrokerAuthLoginOK) Error() string { return fmt.Sprintf("[GET /auth/v1/login][%d] serviceBrokerAuthLoginOK %+v", 200, o.Payload) } +func (o *ServiceBrokerAuthLoginOK) GetPayload() *models.AccessToken { + return o.Payload +} func (o *ServiceBrokerAuthLoginOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -85,7 +83,7 @@ func NewServiceBrokerAuthLoginUnauthorized() *ServiceBrokerAuthLoginUnauthorized return &ServiceBrokerAuthLoginUnauthorized{} } -/*ServiceBrokerAuthLoginUnauthorized handles this case with default header values. +/* ServiceBrokerAuthLoginUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -96,6 +94,9 @@ type ServiceBrokerAuthLoginUnauthorized struct { func (o *ServiceBrokerAuthLoginUnauthorized) Error() string { return fmt.Sprintf("[GET /auth/v1/login][%d] serviceBrokerAuthLoginUnauthorized %+v", 401, o.Payload) } +func (o *ServiceBrokerAuthLoginUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerAuthLoginUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -114,7 +115,7 @@ func NewServiceBrokerAuthLoginInternalServerError() *ServiceBrokerAuthLoginInter return &ServiceBrokerAuthLoginInternalServerError{} } -/*ServiceBrokerAuthLoginInternalServerError handles this case with default header values. +/* ServiceBrokerAuthLoginInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -125,6 +126,9 @@ type ServiceBrokerAuthLoginInternalServerError struct { func (o *ServiceBrokerAuthLoginInternalServerError) Error() string { return fmt.Sprintf("[GET /auth/v1/login][%d] serviceBrokerAuthLoginInternalServerError %+v", 500, o.Payload) } +func (o *ServiceBrokerAuthLoginInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerAuthLoginInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/authentication/service_broker_auth_logout_parameters.go b/power/client/authentication/service_broker_auth_logout_parameters.go index b3af6188..dd227cda 100644 --- a/power/client/authentication/service_broker_auth_logout_parameters.go +++ b/power/client/authentication/service_broker_auth_logout_parameters.go @@ -13,51 +13,49 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewServiceBrokerAuthLogoutParams creates a new ServiceBrokerAuthLogoutParams object -// with the default values initialized. +// NewServiceBrokerAuthLogoutParams creates a new ServiceBrokerAuthLogoutParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewServiceBrokerAuthLogoutParams() *ServiceBrokerAuthLogoutParams { - return &ServiceBrokerAuthLogoutParams{ - timeout: cr.DefaultTimeout, } } // NewServiceBrokerAuthLogoutParamsWithTimeout creates a new ServiceBrokerAuthLogoutParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewServiceBrokerAuthLogoutParamsWithTimeout(timeout time.Duration) *ServiceBrokerAuthLogoutParams { - return &ServiceBrokerAuthLogoutParams{ - timeout: timeout, } } // NewServiceBrokerAuthLogoutParamsWithContext creates a new ServiceBrokerAuthLogoutParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewServiceBrokerAuthLogoutParamsWithContext(ctx context.Context) *ServiceBrokerAuthLogoutParams { - return &ServiceBrokerAuthLogoutParams{ - Context: ctx, } } // NewServiceBrokerAuthLogoutParamsWithHTTPClient creates a new ServiceBrokerAuthLogoutParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewServiceBrokerAuthLogoutParamsWithHTTPClient(client *http.Client) *ServiceBrokerAuthLogoutParams { - return &ServiceBrokerAuthLogoutParams{ HTTPClient: client, } } -/*ServiceBrokerAuthLogoutParams contains all the parameters to send to the API endpoint -for the service broker auth logout operation typically these are written to a http.Request +/* ServiceBrokerAuthLogoutParams contains all the parameters to send to the API endpoint + for the service broker auth logout operation. + + Typically these are written to a http.Request. */ type ServiceBrokerAuthLogoutParams struct { timeout time.Duration @@ -65,6 +63,21 @@ type ServiceBrokerAuthLogoutParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the service broker auth logout params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthLogoutParams) WithDefaults() *ServiceBrokerAuthLogoutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker auth logout params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthLogoutParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the service broker auth logout params func (o *ServiceBrokerAuthLogoutParams) WithTimeout(timeout time.Duration) *ServiceBrokerAuthLogoutParams { o.SetTimeout(timeout) diff --git a/power/client/authentication/service_broker_auth_logout_responses.go b/power/client/authentication/service_broker_auth_logout_responses.go index 819f363d..6907da01 100644 --- a/power/client/authentication/service_broker_auth_logout_responses.go +++ b/power/client/authentication/service_broker_auth_logout_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // ServiceBrokerAuthLogoutReader is a Reader for the ServiceBrokerAuthLogout structure. @@ -24,23 +23,20 @@ type ServiceBrokerAuthLogoutReader struct { // ReadResponse reads a server response into the received o. func (o *ServiceBrokerAuthLogoutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewServiceBrokerAuthLogoutOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 500: result := NewServiceBrokerAuthLogoutInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -49,7 +45,7 @@ func NewServiceBrokerAuthLogoutOK() *ServiceBrokerAuthLogoutOK { return &ServiceBrokerAuthLogoutOK{} } -/*ServiceBrokerAuthLogoutOK handles this case with default header values. +/* ServiceBrokerAuthLogoutOK describes a response with status code 200, with default header values. OK */ @@ -60,6 +56,9 @@ type ServiceBrokerAuthLogoutOK struct { func (o *ServiceBrokerAuthLogoutOK) Error() string { return fmt.Sprintf("[GET /auth/v1/logout][%d] serviceBrokerAuthLogoutOK %+v", 200, o.Payload) } +func (o *ServiceBrokerAuthLogoutOK) GetPayload() models.Object { + return o.Payload +} func (o *ServiceBrokerAuthLogoutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -76,7 +75,7 @@ func NewServiceBrokerAuthLogoutInternalServerError() *ServiceBrokerAuthLogoutInt return &ServiceBrokerAuthLogoutInternalServerError{} } -/*ServiceBrokerAuthLogoutInternalServerError handles this case with default header values. +/* ServiceBrokerAuthLogoutInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -87,6 +86,9 @@ type ServiceBrokerAuthLogoutInternalServerError struct { func (o *ServiceBrokerAuthLogoutInternalServerError) Error() string { return fmt.Sprintf("[GET /auth/v1/logout][%d] serviceBrokerAuthLogoutInternalServerError %+v", 500, o.Payload) } +func (o *ServiceBrokerAuthLogoutInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerAuthLogoutInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/authentication/service_broker_auth_registration_callback_parameters.go b/power/client/authentication/service_broker_auth_registration_callback_parameters.go index f741a44b..0aceb531 100644 --- a/power/client/authentication/service_broker_auth_registration_callback_parameters.go +++ b/power/client/authentication/service_broker_auth_registration_callback_parameters.go @@ -13,51 +13,49 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewServiceBrokerAuthRegistrationCallbackParams creates a new ServiceBrokerAuthRegistrationCallbackParams object -// with the default values initialized. +// NewServiceBrokerAuthRegistrationCallbackParams creates a new ServiceBrokerAuthRegistrationCallbackParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewServiceBrokerAuthRegistrationCallbackParams() *ServiceBrokerAuthRegistrationCallbackParams { - return &ServiceBrokerAuthRegistrationCallbackParams{ - timeout: cr.DefaultTimeout, } } // NewServiceBrokerAuthRegistrationCallbackParamsWithTimeout creates a new ServiceBrokerAuthRegistrationCallbackParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewServiceBrokerAuthRegistrationCallbackParamsWithTimeout(timeout time.Duration) *ServiceBrokerAuthRegistrationCallbackParams { - return &ServiceBrokerAuthRegistrationCallbackParams{ - timeout: timeout, } } // NewServiceBrokerAuthRegistrationCallbackParamsWithContext creates a new ServiceBrokerAuthRegistrationCallbackParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewServiceBrokerAuthRegistrationCallbackParamsWithContext(ctx context.Context) *ServiceBrokerAuthRegistrationCallbackParams { - return &ServiceBrokerAuthRegistrationCallbackParams{ - Context: ctx, } } // NewServiceBrokerAuthRegistrationCallbackParamsWithHTTPClient creates a new ServiceBrokerAuthRegistrationCallbackParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewServiceBrokerAuthRegistrationCallbackParamsWithHTTPClient(client *http.Client) *ServiceBrokerAuthRegistrationCallbackParams { - return &ServiceBrokerAuthRegistrationCallbackParams{ HTTPClient: client, } } -/*ServiceBrokerAuthRegistrationCallbackParams contains all the parameters to send to the API endpoint -for the service broker auth registration callback operation typically these are written to a http.Request +/* ServiceBrokerAuthRegistrationCallbackParams contains all the parameters to send to the API endpoint + for the service broker auth registration callback operation. + + Typically these are written to a http.Request. */ type ServiceBrokerAuthRegistrationCallbackParams struct { timeout time.Duration @@ -65,6 +63,21 @@ type ServiceBrokerAuthRegistrationCallbackParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the service broker auth registration callback params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthRegistrationCallbackParams) WithDefaults() *ServiceBrokerAuthRegistrationCallbackParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker auth registration callback params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthRegistrationCallbackParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the service broker auth registration callback params func (o *ServiceBrokerAuthRegistrationCallbackParams) WithTimeout(timeout time.Duration) *ServiceBrokerAuthRegistrationCallbackParams { o.SetTimeout(timeout) diff --git a/power/client/authentication/service_broker_auth_registration_callback_responses.go b/power/client/authentication/service_broker_auth_registration_callback_responses.go index 5c08aab1..bc09a805 100644 --- a/power/client/authentication/service_broker_auth_registration_callback_responses.go +++ b/power/client/authentication/service_broker_auth_registration_callback_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // ServiceBrokerAuthRegistrationCallbackReader is a Reader for the ServiceBrokerAuthRegistrationCallback structure. @@ -24,30 +23,26 @@ type ServiceBrokerAuthRegistrationCallbackReader struct { // ReadResponse reads a server response into the received o. func (o *ServiceBrokerAuthRegistrationCallbackReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewServiceBrokerAuthRegistrationCallbackOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 401: result := NewServiceBrokerAuthRegistrationCallbackUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewServiceBrokerAuthRegistrationCallbackInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -56,7 +51,7 @@ func NewServiceBrokerAuthRegistrationCallbackOK() *ServiceBrokerAuthRegistration return &ServiceBrokerAuthRegistrationCallbackOK{} } -/*ServiceBrokerAuthRegistrationCallbackOK handles this case with default header values. +/* ServiceBrokerAuthRegistrationCallbackOK describes a response with status code 200, with default header values. OK */ @@ -67,6 +62,9 @@ type ServiceBrokerAuthRegistrationCallbackOK struct { func (o *ServiceBrokerAuthRegistrationCallbackOK) Error() string { return fmt.Sprintf("[GET /auth/v1/callback-registration][%d] serviceBrokerAuthRegistrationCallbackOK %+v", 200, o.Payload) } +func (o *ServiceBrokerAuthRegistrationCallbackOK) GetPayload() *models.AccessToken { + return o.Payload +} func (o *ServiceBrokerAuthRegistrationCallbackOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -85,7 +83,7 @@ func NewServiceBrokerAuthRegistrationCallbackUnauthorized() *ServiceBrokerAuthRe return &ServiceBrokerAuthRegistrationCallbackUnauthorized{} } -/*ServiceBrokerAuthRegistrationCallbackUnauthorized handles this case with default header values. +/* ServiceBrokerAuthRegistrationCallbackUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -96,6 +94,9 @@ type ServiceBrokerAuthRegistrationCallbackUnauthorized struct { func (o *ServiceBrokerAuthRegistrationCallbackUnauthorized) Error() string { return fmt.Sprintf("[GET /auth/v1/callback-registration][%d] serviceBrokerAuthRegistrationCallbackUnauthorized %+v", 401, o.Payload) } +func (o *ServiceBrokerAuthRegistrationCallbackUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerAuthRegistrationCallbackUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -114,7 +115,7 @@ func NewServiceBrokerAuthRegistrationCallbackInternalServerError() *ServiceBroke return &ServiceBrokerAuthRegistrationCallbackInternalServerError{} } -/*ServiceBrokerAuthRegistrationCallbackInternalServerError handles this case with default header values. +/* ServiceBrokerAuthRegistrationCallbackInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -125,6 +126,9 @@ type ServiceBrokerAuthRegistrationCallbackInternalServerError struct { func (o *ServiceBrokerAuthRegistrationCallbackInternalServerError) Error() string { return fmt.Sprintf("[GET /auth/v1/callback-registration][%d] serviceBrokerAuthRegistrationCallbackInternalServerError %+v", 500, o.Payload) } +func (o *ServiceBrokerAuthRegistrationCallbackInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerAuthRegistrationCallbackInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/authentication/service_broker_auth_registration_parameters.go b/power/client/authentication/service_broker_auth_registration_parameters.go index dfacdda9..3a49c00a 100644 --- a/power/client/authentication/service_broker_auth_registration_parameters.go +++ b/power/client/authentication/service_broker_auth_registration_parameters.go @@ -13,83 +13,86 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - - strfmt "github.com/go-openapi/strfmt" ) -// NewServiceBrokerAuthRegistrationParams creates a new ServiceBrokerAuthRegistrationParams object -// with the default values initialized. +// NewServiceBrokerAuthRegistrationParams creates a new ServiceBrokerAuthRegistrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewServiceBrokerAuthRegistrationParams() *ServiceBrokerAuthRegistrationParams { - var () return &ServiceBrokerAuthRegistrationParams{ - timeout: cr.DefaultTimeout, } } // NewServiceBrokerAuthRegistrationParamsWithTimeout creates a new ServiceBrokerAuthRegistrationParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewServiceBrokerAuthRegistrationParamsWithTimeout(timeout time.Duration) *ServiceBrokerAuthRegistrationParams { - var () return &ServiceBrokerAuthRegistrationParams{ - timeout: timeout, } } // NewServiceBrokerAuthRegistrationParamsWithContext creates a new ServiceBrokerAuthRegistrationParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewServiceBrokerAuthRegistrationParamsWithContext(ctx context.Context) *ServiceBrokerAuthRegistrationParams { - var () return &ServiceBrokerAuthRegistrationParams{ - Context: ctx, } } // NewServiceBrokerAuthRegistrationParamsWithHTTPClient creates a new ServiceBrokerAuthRegistrationParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewServiceBrokerAuthRegistrationParamsWithHTTPClient(client *http.Client) *ServiceBrokerAuthRegistrationParams { - var () return &ServiceBrokerAuthRegistrationParams{ HTTPClient: client, } } -/*ServiceBrokerAuthRegistrationParams contains all the parameters to send to the API endpoint -for the service broker auth registration operation typically these are written to a http.Request +/* ServiceBrokerAuthRegistrationParams contains all the parameters to send to the API endpoint + for the service broker auth registration operation. + + Typically these are written to a http.Request. */ type ServiceBrokerAuthRegistrationParams struct { - /*EntitlementID - Entitlement ID of for this tenant + /* EntitlementID. + Entitlement ID of for this tenant */ EntitlementID string - /*Icn - IBM Customer Number (ICN) for this tenant + /* Icn. + + IBM Customer Number (ICN) for this tenant */ Icn string - /*Plan - Plan for this tenant and entitlement + /* Plan. + + Plan for this tenant and entitlement */ Plan string - /*RedirectURL - The URL to redirect to after login/registration + /* RedirectURL. + + The URL to redirect to after login/registration */ RedirectURL *string - /*Regions - An array of regions matching the number of cloud-instances in the plan + /* Regions. + + An array of regions matching the number of cloud-instances in the plan */ Regions []string - /*TenantID - Tenant ID of a pcloud tenant + /* TenantID. + + Tenant ID of a pcloud tenant */ TenantID string @@ -98,6 +101,21 @@ type ServiceBrokerAuthRegistrationParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the service broker auth registration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthRegistrationParams) WithDefaults() *ServiceBrokerAuthRegistrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker auth registration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthRegistrationParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the service broker auth registration params func (o *ServiceBrokerAuthRegistrationParams) WithTimeout(timeout time.Duration) *ServiceBrokerAuthRegistrationParams { o.SetTimeout(timeout) @@ -209,6 +227,7 @@ func (o *ServiceBrokerAuthRegistrationParams) WriteToRequest(r runtime.ClientReq qrEntitlementID := o.EntitlementID qEntitlementID := qrEntitlementID if qEntitlementID != "" { + if err := r.SetQueryParam("entitlement_id", qEntitlementID); err != nil { return err } @@ -218,6 +237,7 @@ func (o *ServiceBrokerAuthRegistrationParams) WriteToRequest(r runtime.ClientReq qrIcn := o.Icn qIcn := qrIcn if qIcn != "" { + if err := r.SetQueryParam("icn", qIcn); err != nil { return err } @@ -227,6 +247,7 @@ func (o *ServiceBrokerAuthRegistrationParams) WriteToRequest(r runtime.ClientReq qrPlan := o.Plan qPlan := qrPlan if qPlan != "" { + if err := r.SetQueryParam("plan", qPlan); err != nil { return err } @@ -236,30 +257,35 @@ func (o *ServiceBrokerAuthRegistrationParams) WriteToRequest(r runtime.ClientReq // query param redirect_url var qrRedirectURL string + if o.RedirectURL != nil { qrRedirectURL = *o.RedirectURL } qRedirectURL := qrRedirectURL if qRedirectURL != "" { + if err := r.SetQueryParam("redirect_url", qRedirectURL); err != nil { return err } } - } - valuesRegions := o.Regions + if o.Regions != nil { - joinedRegions := swag.JoinByFormat(valuesRegions, "") - // query array param regions - if err := r.SetQueryParam("regions", joinedRegions...); err != nil { - return err + // binding items for regions + joinedRegions := o.bindParamRegions(reg) + + // query array param regions + if err := r.SetQueryParam("regions", joinedRegions...); err != nil { + return err + } } // query param tenant_id qrTenantID := o.TenantID qTenantID := qrTenantID if qTenantID != "" { + if err := r.SetQueryParam("tenant_id", qTenantID); err != nil { return err } @@ -270,3 +296,20 @@ func (o *ServiceBrokerAuthRegistrationParams) WriteToRequest(r runtime.ClientReq } return nil } + +// bindParamServiceBrokerAuthRegistration binds the parameter regions +func (o *ServiceBrokerAuthRegistrationParams) bindParamRegions(formats strfmt.Registry) []string { + regionsIR := o.Regions + + var regionsIC []string + for _, regionsIIR := range regionsIR { // explode []string + + regionsIIV := regionsIIR // string as string + regionsIC = append(regionsIC, regionsIIV) + } + + // items.CollectionFormat: "" + regionsIS := swag.JoinByFormat(regionsIC, "") + + return regionsIS +} diff --git a/power/client/authentication/service_broker_auth_registration_responses.go b/power/client/authentication/service_broker_auth_registration_responses.go index ab0ea712..7ccbe10a 100644 --- a/power/client/authentication/service_broker_auth_registration_responses.go +++ b/power/client/authentication/service_broker_auth_registration_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // ServiceBrokerAuthRegistrationReader is a Reader for the ServiceBrokerAuthRegistration structure. @@ -24,30 +23,26 @@ type ServiceBrokerAuthRegistrationReader struct { // ReadResponse reads a server response into the received o. func (o *ServiceBrokerAuthRegistrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewServiceBrokerAuthRegistrationOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 401: result := NewServiceBrokerAuthRegistrationUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewServiceBrokerAuthRegistrationInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -56,7 +51,7 @@ func NewServiceBrokerAuthRegistrationOK() *ServiceBrokerAuthRegistrationOK { return &ServiceBrokerAuthRegistrationOK{} } -/*ServiceBrokerAuthRegistrationOK handles this case with default header values. +/* ServiceBrokerAuthRegistrationOK describes a response with status code 200, with default header values. OK */ @@ -67,6 +62,9 @@ type ServiceBrokerAuthRegistrationOK struct { func (o *ServiceBrokerAuthRegistrationOK) Error() string { return fmt.Sprintf("[GET /auth/v1/registration][%d] serviceBrokerAuthRegistrationOK %+v", 200, o.Payload) } +func (o *ServiceBrokerAuthRegistrationOK) GetPayload() *models.AccessToken { + return o.Payload +} func (o *ServiceBrokerAuthRegistrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -85,7 +83,7 @@ func NewServiceBrokerAuthRegistrationUnauthorized() *ServiceBrokerAuthRegistrati return &ServiceBrokerAuthRegistrationUnauthorized{} } -/*ServiceBrokerAuthRegistrationUnauthorized handles this case with default header values. +/* ServiceBrokerAuthRegistrationUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -96,6 +94,9 @@ type ServiceBrokerAuthRegistrationUnauthorized struct { func (o *ServiceBrokerAuthRegistrationUnauthorized) Error() string { return fmt.Sprintf("[GET /auth/v1/registration][%d] serviceBrokerAuthRegistrationUnauthorized %+v", 401, o.Payload) } +func (o *ServiceBrokerAuthRegistrationUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerAuthRegistrationUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -114,7 +115,7 @@ func NewServiceBrokerAuthRegistrationInternalServerError() *ServiceBrokerAuthReg return &ServiceBrokerAuthRegistrationInternalServerError{} } -/*ServiceBrokerAuthRegistrationInternalServerError handles this case with default header values. +/* ServiceBrokerAuthRegistrationInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -125,6 +126,9 @@ type ServiceBrokerAuthRegistrationInternalServerError struct { func (o *ServiceBrokerAuthRegistrationInternalServerError) Error() string { return fmt.Sprintf("[GET /auth/v1/registration][%d] serviceBrokerAuthRegistrationInternalServerError %+v", 500, o.Payload) } +func (o *ServiceBrokerAuthRegistrationInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerAuthRegistrationInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/authentication/service_broker_auth_token_post_parameters.go b/power/client/authentication/service_broker_auth_token_post_parameters.go index 00a99209..7c77f5ac 100644 --- a/power/client/authentication/service_broker_auth_token_post_parameters.go +++ b/power/client/authentication/service_broker_auth_token_post_parameters.go @@ -13,59 +13,57 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewServiceBrokerAuthTokenPostParams creates a new ServiceBrokerAuthTokenPostParams object -// with the default values initialized. +// NewServiceBrokerAuthTokenPostParams creates a new ServiceBrokerAuthTokenPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewServiceBrokerAuthTokenPostParams() *ServiceBrokerAuthTokenPostParams { - var () return &ServiceBrokerAuthTokenPostParams{ - timeout: cr.DefaultTimeout, } } // NewServiceBrokerAuthTokenPostParamsWithTimeout creates a new ServiceBrokerAuthTokenPostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewServiceBrokerAuthTokenPostParamsWithTimeout(timeout time.Duration) *ServiceBrokerAuthTokenPostParams { - var () return &ServiceBrokerAuthTokenPostParams{ - timeout: timeout, } } // NewServiceBrokerAuthTokenPostParamsWithContext creates a new ServiceBrokerAuthTokenPostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewServiceBrokerAuthTokenPostParamsWithContext(ctx context.Context) *ServiceBrokerAuthTokenPostParams { - var () return &ServiceBrokerAuthTokenPostParams{ - Context: ctx, } } // NewServiceBrokerAuthTokenPostParamsWithHTTPClient creates a new ServiceBrokerAuthTokenPostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewServiceBrokerAuthTokenPostParamsWithHTTPClient(client *http.Client) *ServiceBrokerAuthTokenPostParams { - var () return &ServiceBrokerAuthTokenPostParams{ HTTPClient: client, } } -/*ServiceBrokerAuthTokenPostParams contains all the parameters to send to the API endpoint -for the service broker auth token post operation typically these are written to a http.Request +/* ServiceBrokerAuthTokenPostParams contains all the parameters to send to the API endpoint + for the service broker auth token post operation. + + Typically these are written to a http.Request. */ type ServiceBrokerAuthTokenPostParams struct { - /*Body - Parameters for requesting a new Token from a Refresh Token + /* Body. + Parameters for requesting a new Token from a Refresh Token */ Body *models.TokenRequest @@ -74,6 +72,21 @@ type ServiceBrokerAuthTokenPostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the service broker auth token post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthTokenPostParams) WithDefaults() *ServiceBrokerAuthTokenPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker auth token post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthTokenPostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the service broker auth token post params func (o *ServiceBrokerAuthTokenPostParams) WithTimeout(timeout time.Duration) *ServiceBrokerAuthTokenPostParams { o.SetTimeout(timeout) @@ -125,7 +138,6 @@ func (o *ServiceBrokerAuthTokenPostParams) WriteToRequest(r runtime.ClientReques return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/authentication/service_broker_auth_token_post_responses.go b/power/client/authentication/service_broker_auth_token_post_responses.go index e73831d7..72087200 100644 --- a/power/client/authentication/service_broker_auth_token_post_responses.go +++ b/power/client/authentication/service_broker_auth_token_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // ServiceBrokerAuthTokenPostReader is a Reader for the ServiceBrokerAuthTokenPost structure. @@ -24,44 +23,38 @@ type ServiceBrokerAuthTokenPostReader struct { // ReadResponse reads a server response into the received o. func (o *ServiceBrokerAuthTokenPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewServiceBrokerAuthTokenPostOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewServiceBrokerAuthTokenPostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 403: result := NewServiceBrokerAuthTokenPostForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 429: result := NewServiceBrokerAuthTokenPostTooManyRequests() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewServiceBrokerAuthTokenPostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewServiceBrokerAuthTokenPostOK() *ServiceBrokerAuthTokenPostOK { return &ServiceBrokerAuthTokenPostOK{} } -/*ServiceBrokerAuthTokenPostOK handles this case with default header values. +/* ServiceBrokerAuthTokenPostOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type ServiceBrokerAuthTokenPostOK struct { func (o *ServiceBrokerAuthTokenPostOK) Error() string { return fmt.Sprintf("[POST /auth/v1/token][%d] serviceBrokerAuthTokenPostOK %+v", 200, o.Payload) } +func (o *ServiceBrokerAuthTokenPostOK) GetPayload() *models.Token { + return o.Payload +} func (o *ServiceBrokerAuthTokenPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewServiceBrokerAuthTokenPostBadRequest() *ServiceBrokerAuthTokenPostBadReq return &ServiceBrokerAuthTokenPostBadRequest{} } -/*ServiceBrokerAuthTokenPostBadRequest handles this case with default header values. +/* ServiceBrokerAuthTokenPostBadRequest describes a response with status code 400, with default header values. Authorization pending */ @@ -110,6 +106,9 @@ type ServiceBrokerAuthTokenPostBadRequest struct { func (o *ServiceBrokerAuthTokenPostBadRequest) Error() string { return fmt.Sprintf("[POST /auth/v1/token][%d] serviceBrokerAuthTokenPostBadRequest %+v", 400, o.Payload) } +func (o *ServiceBrokerAuthTokenPostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerAuthTokenPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewServiceBrokerAuthTokenPostForbidden() *ServiceBrokerAuthTokenPostForbidd return &ServiceBrokerAuthTokenPostForbidden{} } -/*ServiceBrokerAuthTokenPostForbidden handles this case with default header values. +/* ServiceBrokerAuthTokenPostForbidden describes a response with status code 403, with default header values. User refused grant */ @@ -139,6 +138,9 @@ type ServiceBrokerAuthTokenPostForbidden struct { func (o *ServiceBrokerAuthTokenPostForbidden) Error() string { return fmt.Sprintf("[POST /auth/v1/token][%d] serviceBrokerAuthTokenPostForbidden %+v", 403, o.Payload) } +func (o *ServiceBrokerAuthTokenPostForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerAuthTokenPostForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewServiceBrokerAuthTokenPostTooManyRequests() *ServiceBrokerAuthTokenPostT return &ServiceBrokerAuthTokenPostTooManyRequests{} } -/*ServiceBrokerAuthTokenPostTooManyRequests handles this case with default header values. +/* ServiceBrokerAuthTokenPostTooManyRequests describes a response with status code 429, with default header values. Polling too frequently */ @@ -168,6 +170,9 @@ type ServiceBrokerAuthTokenPostTooManyRequests struct { func (o *ServiceBrokerAuthTokenPostTooManyRequests) Error() string { return fmt.Sprintf("[POST /auth/v1/token][%d] serviceBrokerAuthTokenPostTooManyRequests %+v", 429, o.Payload) } +func (o *ServiceBrokerAuthTokenPostTooManyRequests) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerAuthTokenPostTooManyRequests) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewServiceBrokerAuthTokenPostInternalServerError() *ServiceBrokerAuthTokenP return &ServiceBrokerAuthTokenPostInternalServerError{} } -/*ServiceBrokerAuthTokenPostInternalServerError handles this case with default header values. +/* ServiceBrokerAuthTokenPostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type ServiceBrokerAuthTokenPostInternalServerError struct { func (o *ServiceBrokerAuthTokenPostInternalServerError) Error() string { return fmt.Sprintf("[POST /auth/v1/token][%d] serviceBrokerAuthTokenPostInternalServerError %+v", 500, o.Payload) } +func (o *ServiceBrokerAuthTokenPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerAuthTokenPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/bluemix_service_instances/bluemix_service_instance_get_parameters.go b/power/client/bluemix_service_instances/bluemix_service_instance_get_parameters.go index fc39f69c..185400b2 100644 --- a/power/client/bluemix_service_instances/bluemix_service_instance_get_parameters.go +++ b/power/client/bluemix_service_instances/bluemix_service_instance_get_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewBluemixServiceInstanceGetParams creates a new BluemixServiceInstanceGetParams object -// with the default values initialized. +// NewBluemixServiceInstanceGetParams creates a new BluemixServiceInstanceGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewBluemixServiceInstanceGetParams() *BluemixServiceInstanceGetParams { - var () return &BluemixServiceInstanceGetParams{ - timeout: cr.DefaultTimeout, } } // NewBluemixServiceInstanceGetParamsWithTimeout creates a new BluemixServiceInstanceGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewBluemixServiceInstanceGetParamsWithTimeout(timeout time.Duration) *BluemixServiceInstanceGetParams { - var () return &BluemixServiceInstanceGetParams{ - timeout: timeout, } } // NewBluemixServiceInstanceGetParamsWithContext creates a new BluemixServiceInstanceGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewBluemixServiceInstanceGetParamsWithContext(ctx context.Context) *BluemixServiceInstanceGetParams { - var () return &BluemixServiceInstanceGetParams{ - Context: ctx, } } // NewBluemixServiceInstanceGetParamsWithHTTPClient creates a new BluemixServiceInstanceGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewBluemixServiceInstanceGetParamsWithHTTPClient(client *http.Client) *BluemixServiceInstanceGetParams { - var () return &BluemixServiceInstanceGetParams{ HTTPClient: client, } } -/*BluemixServiceInstanceGetParams contains all the parameters to send to the API endpoint -for the bluemix service instance get operation typically these are written to a http.Request +/* BluemixServiceInstanceGetParams contains all the parameters to send to the API endpoint + for the bluemix service instance get operation. + + Typically these are written to a http.Request. */ type BluemixServiceInstanceGetParams struct { - /*InstanceID - instance id of instance to provision + /* InstanceID. + instance id of instance to provision */ InstanceID string @@ -72,6 +70,21 @@ type BluemixServiceInstanceGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the bluemix service instance get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *BluemixServiceInstanceGetParams) WithDefaults() *BluemixServiceInstanceGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the bluemix service instance get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *BluemixServiceInstanceGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the bluemix service instance get params func (o *BluemixServiceInstanceGetParams) WithTimeout(timeout time.Duration) *BluemixServiceInstanceGetParams { o.SetTimeout(timeout) diff --git a/power/client/bluemix_service_instances/bluemix_service_instance_get_responses.go b/power/client/bluemix_service_instances/bluemix_service_instance_get_responses.go index 928de7fe..0fe5b096 100644 --- a/power/client/bluemix_service_instances/bluemix_service_instance_get_responses.go +++ b/power/client/bluemix_service_instances/bluemix_service_instance_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // BluemixServiceInstanceGetReader is a Reader for the BluemixServiceInstanceGet structure. @@ -24,23 +23,20 @@ type BluemixServiceInstanceGetReader struct { // ReadResponse reads a server response into the received o. func (o *BluemixServiceInstanceGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewBluemixServiceInstanceGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewBluemixServiceInstanceGetBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -49,7 +45,7 @@ func NewBluemixServiceInstanceGetOK() *BluemixServiceInstanceGetOK { return &BluemixServiceInstanceGetOK{} } -/*BluemixServiceInstanceGetOK handles this case with default header values. +/* BluemixServiceInstanceGetOK describes a response with status code 200, with default header values. OK */ @@ -60,6 +56,9 @@ type BluemixServiceInstanceGetOK struct { func (o *BluemixServiceInstanceGetOK) Error() string { return fmt.Sprintf("[GET /bluemix_v1/service_instances/{instance_id}][%d] bluemixServiceInstanceGetOK %+v", 200, o.Payload) } +func (o *BluemixServiceInstanceGetOK) GetPayload() *models.ServiceInstance { + return o.Payload +} func (o *BluemixServiceInstanceGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -78,7 +77,7 @@ func NewBluemixServiceInstanceGetBadRequest() *BluemixServiceInstanceGetBadReque return &BluemixServiceInstanceGetBadRequest{} } -/*BluemixServiceInstanceGetBadRequest handles this case with default header values. +/* BluemixServiceInstanceGetBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -89,6 +88,9 @@ type BluemixServiceInstanceGetBadRequest struct { func (o *BluemixServiceInstanceGetBadRequest) Error() string { return fmt.Sprintf("[GET /bluemix_v1/service_instances/{instance_id}][%d] bluemixServiceInstanceGetBadRequest %+v", 400, o.Payload) } +func (o *BluemixServiceInstanceGetBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *BluemixServiceInstanceGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/bluemix_service_instances/bluemix_service_instance_put_parameters.go b/power/client/bluemix_service_instances/bluemix_service_instance_put_parameters.go index 0b0b7b09..7bc989be 100644 --- a/power/client/bluemix_service_instances/bluemix_service_instance_put_parameters.go +++ b/power/client/bluemix_service_instances/bluemix_service_instance_put_parameters.go @@ -13,64 +13,63 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewBluemixServiceInstancePutParams creates a new BluemixServiceInstancePutParams object -// with the default values initialized. +// NewBluemixServiceInstancePutParams creates a new BluemixServiceInstancePutParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewBluemixServiceInstancePutParams() *BluemixServiceInstancePutParams { - var () return &BluemixServiceInstancePutParams{ - timeout: cr.DefaultTimeout, } } // NewBluemixServiceInstancePutParamsWithTimeout creates a new BluemixServiceInstancePutParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewBluemixServiceInstancePutParamsWithTimeout(timeout time.Duration) *BluemixServiceInstancePutParams { - var () return &BluemixServiceInstancePutParams{ - timeout: timeout, } } // NewBluemixServiceInstancePutParamsWithContext creates a new BluemixServiceInstancePutParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewBluemixServiceInstancePutParamsWithContext(ctx context.Context) *BluemixServiceInstancePutParams { - var () return &BluemixServiceInstancePutParams{ - Context: ctx, } } // NewBluemixServiceInstancePutParamsWithHTTPClient creates a new BluemixServiceInstancePutParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewBluemixServiceInstancePutParamsWithHTTPClient(client *http.Client) *BluemixServiceInstancePutParams { - var () return &BluemixServiceInstancePutParams{ HTTPClient: client, } } -/*BluemixServiceInstancePutParams contains all the parameters to send to the API endpoint -for the bluemix service instance put operation typically these are written to a http.Request +/* BluemixServiceInstancePutParams contains all the parameters to send to the API endpoint + for the bluemix service instance put operation. + + Typically these are written to a http.Request. */ type BluemixServiceInstancePutParams struct { - /*Body - parameters for the requested state of a provisioned service + /* Body. + parameters for the requested state of a provisioned service */ Body *models.ServiceInstanceRequest - /*InstanceID - instance id of instance to provision + /* InstanceID. + + instance id of instance to provision */ InstanceID string @@ -79,6 +78,21 @@ type BluemixServiceInstancePutParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the bluemix service instance put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *BluemixServiceInstancePutParams) WithDefaults() *BluemixServiceInstancePutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the bluemix service instance put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *BluemixServiceInstancePutParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the bluemix service instance put params func (o *BluemixServiceInstancePutParams) WithTimeout(timeout time.Duration) *BluemixServiceInstancePutParams { o.SetTimeout(timeout) @@ -141,7 +155,6 @@ func (o *BluemixServiceInstancePutParams) WriteToRequest(r runtime.ClientRequest return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/bluemix_service_instances/bluemix_service_instance_put_responses.go b/power/client/bluemix_service_instances/bluemix_service_instance_put_responses.go index 63f74946..d35787f1 100644 --- a/power/client/bluemix_service_instances/bluemix_service_instance_put_responses.go +++ b/power/client/bluemix_service_instances/bluemix_service_instance_put_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // BluemixServiceInstancePutReader is a Reader for the BluemixServiceInstancePut structure. @@ -24,23 +23,20 @@ type BluemixServiceInstancePutReader struct { // ReadResponse reads a server response into the received o. func (o *BluemixServiceInstancePutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewBluemixServiceInstancePutOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewBluemixServiceInstancePutBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -49,7 +45,7 @@ func NewBluemixServiceInstancePutOK() *BluemixServiceInstancePutOK { return &BluemixServiceInstancePutOK{} } -/*BluemixServiceInstancePutOK handles this case with default header values. +/* BluemixServiceInstancePutOK describes a response with status code 200, with default header values. OK */ @@ -60,6 +56,9 @@ type BluemixServiceInstancePutOK struct { func (o *BluemixServiceInstancePutOK) Error() string { return fmt.Sprintf("[PUT /bluemix_v1/service_instances/{instance_id}][%d] bluemixServiceInstancePutOK %+v", 200, o.Payload) } +func (o *BluemixServiceInstancePutOK) GetPayload() *models.ServiceInstance { + return o.Payload +} func (o *BluemixServiceInstancePutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -78,7 +77,7 @@ func NewBluemixServiceInstancePutBadRequest() *BluemixServiceInstancePutBadReque return &BluemixServiceInstancePutBadRequest{} } -/*BluemixServiceInstancePutBadRequest handles this case with default header values. +/* BluemixServiceInstancePutBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -89,6 +88,9 @@ type BluemixServiceInstancePutBadRequest struct { func (o *BluemixServiceInstancePutBadRequest) Error() string { return fmt.Sprintf("[PUT /bluemix_v1/service_instances/{instance_id}][%d] bluemixServiceInstancePutBadRequest %+v", 400, o.Payload) } +func (o *BluemixServiceInstancePutBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *BluemixServiceInstancePutBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/bluemix_service_instances/bluemix_service_instances_client.go b/power/client/bluemix_service_instances/bluemix_service_instances_client.go index 6e0787f7..d0cb0758 100644 --- a/power/client/bluemix_service_instances/bluemix_service_instances_client.go +++ b/power/client/bluemix_service_instances/bluemix_service_instances_client.go @@ -6,13 +6,14 @@ package bluemix_service_instances // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/runtime" + "fmt" - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" ) // New creates a new bluemix service instances API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { return &Client{transport: transport, formats: formats} } @@ -24,16 +25,27 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + BluemixServiceInstanceGet(params *BluemixServiceInstanceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*BluemixServiceInstanceGetOK, error) + + BluemixServiceInstancePut(params *BluemixServiceInstancePutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*BluemixServiceInstancePutOK, error) + + SetTransport(transport runtime.ClientTransport) +} + /* -BluemixServiceInstanceGet gets the current state information associated with the service instance + BluemixServiceInstanceGet gets the current state information associated with the service instance */ -func (a *Client) BluemixServiceInstanceGet(params *BluemixServiceInstanceGetParams, authInfo runtime.ClientAuthInfoWriter) (*BluemixServiceInstanceGetOK, error) { +func (a *Client) BluemixServiceInstanceGet(params *BluemixServiceInstanceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*BluemixServiceInstanceGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewBluemixServiceInstanceGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "bluemix.serviceInstance.get", Method: "GET", PathPattern: "/bluemix_v1/service_instances/{instance_id}", @@ -45,24 +57,34 @@ func (a *Client) BluemixServiceInstanceGet(params *BluemixServiceInstanceGetPara AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*BluemixServiceInstanceGetOK), nil - + success, ok := result.(*BluemixServiceInstanceGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for bluemix.serviceInstance.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -BluemixServiceInstancePut updates disable or enable the state of a provisioned service instance + BluemixServiceInstancePut updates disable or enable the state of a provisioned service instance */ -func (a *Client) BluemixServiceInstancePut(params *BluemixServiceInstancePutParams, authInfo runtime.ClientAuthInfoWriter) (*BluemixServiceInstancePutOK, error) { +func (a *Client) BluemixServiceInstancePut(params *BluemixServiceInstancePutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*BluemixServiceInstancePutOK, error) { // TODO: Validate the params before sending if params == nil { params = NewBluemixServiceInstancePutParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "bluemix.serviceInstance.put", Method: "PUT", PathPattern: "/bluemix_v1/service_instances/{instance_id}", @@ -74,12 +96,23 @@ func (a *Client) BluemixServiceInstancePut(params *BluemixServiceInstancePutPara AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*BluemixServiceInstancePutOK), nil - + success, ok := result.(*BluemixServiceInstancePutOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for bluemix.serviceInstance.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } // SetTransport changes the transport on the client diff --git a/power/client/catalog/catalog_client.go b/power/client/catalog/catalog_client.go index efc5a54d..265b7dfe 100644 --- a/power/client/catalog/catalog_client.go +++ b/power/client/catalog/catalog_client.go @@ -6,13 +6,14 @@ package catalog // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/runtime" + "fmt" - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" ) // New creates a new catalog API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { return &Client{transport: transport, formats: formats} } @@ -24,16 +25,25 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + CatalogGet(params *CatalogGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CatalogGetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + /* -CatalogGet gets the catalog of services that the service broker offers + CatalogGet gets the catalog of services that the service broker offers */ -func (a *Client) CatalogGet(params *CatalogGetParams, authInfo runtime.ClientAuthInfoWriter) (*CatalogGetOK, error) { +func (a *Client) CatalogGet(params *CatalogGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CatalogGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewCatalogGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "catalog.get", Method: "GET", PathPattern: "/v2/catalog", @@ -45,12 +55,23 @@ func (a *Client) CatalogGet(params *CatalogGetParams, authInfo runtime.ClientAut AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*CatalogGetOK), nil - + success, ok := result.(*CatalogGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for catalog.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } // SetTransport changes the transport on the client diff --git a/power/client/catalog/catalog_get_parameters.go b/power/client/catalog/catalog_get_parameters.go index 3a9f01f5..5f11d0a1 100644 --- a/power/client/catalog/catalog_get_parameters.go +++ b/power/client/catalog/catalog_get_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewCatalogGetParams creates a new CatalogGetParams object -// with the default values initialized. +// NewCatalogGetParams creates a new CatalogGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewCatalogGetParams() *CatalogGetParams { - var () return &CatalogGetParams{ - timeout: cr.DefaultTimeout, } } // NewCatalogGetParamsWithTimeout creates a new CatalogGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewCatalogGetParamsWithTimeout(timeout time.Duration) *CatalogGetParams { - var () return &CatalogGetParams{ - timeout: timeout, } } // NewCatalogGetParamsWithContext creates a new CatalogGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewCatalogGetParamsWithContext(ctx context.Context) *CatalogGetParams { - var () return &CatalogGetParams{ - Context: ctx, } } // NewCatalogGetParamsWithHTTPClient creates a new CatalogGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewCatalogGetParamsWithHTTPClient(client *http.Client) *CatalogGetParams { - var () return &CatalogGetParams{ HTTPClient: client, } } -/*CatalogGetParams contains all the parameters to send to the API endpoint -for the catalog get operation typically these are written to a http.Request +/* CatalogGetParams contains all the parameters to send to the API endpoint + for the catalog get operation. + + Typically these are written to a http.Request. */ type CatalogGetParams struct { - /*XBrokerAPIVersion - version number of the Service Broker API that the Platform will use + /* XBrokerAPIVersion. + version number of the Service Broker API that the Platform will use */ XBrokerAPIVersion string @@ -72,6 +70,21 @@ type CatalogGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the catalog get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CatalogGetParams) WithDefaults() *CatalogGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the catalog get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CatalogGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the catalog get params func (o *CatalogGetParams) WithTimeout(timeout time.Duration) *CatalogGetParams { o.SetTimeout(timeout) diff --git a/power/client/catalog/catalog_get_responses.go b/power/client/catalog/catalog_get_responses.go index 5a03deb6..448d665f 100644 --- a/power/client/catalog/catalog_get_responses.go +++ b/power/client/catalog/catalog_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // CatalogGetReader is a Reader for the CatalogGet structure. @@ -24,16 +23,14 @@ type CatalogGetReader struct { // ReadResponse reads a server response into the received o. func (o *CatalogGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewCatalogGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -42,7 +39,7 @@ func NewCatalogGetOK() *CatalogGetOK { return &CatalogGetOK{} } -/*CatalogGetOK handles this case with default header values. +/* CatalogGetOK describes a response with status code 200, with default header values. catalog response */ @@ -53,6 +50,9 @@ type CatalogGetOK struct { func (o *CatalogGetOK) Error() string { return fmt.Sprintf("[GET /v2/catalog][%d] catalogGetOK %+v", 200, o.Payload) } +func (o *CatalogGetOK) GetPayload() *models.Catalog { + return o.Payload +} func (o *CatalogGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/hardware_platforms/hardware_platforms_client.go b/power/client/hardware_platforms/hardware_platforms_client.go index d58ff86a..0cb215ec 100644 --- a/power/client/hardware_platforms/hardware_platforms_client.go +++ b/power/client/hardware_platforms/hardware_platforms_client.go @@ -6,13 +6,14 @@ package hardware_platforms // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/runtime" + "fmt" - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" ) // New creates a new hardware platforms API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { return &Client{transport: transport, formats: formats} } @@ -24,16 +25,25 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + ServiceBrokerHardwareplatformsGet(params *ServiceBrokerHardwareplatformsGetParams, opts ...ClientOption) (*ServiceBrokerHardwareplatformsGetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + /* -ServiceBrokerHardwareplatformsGet availables hardware statistics and limits + ServiceBrokerHardwareplatformsGet availables hardware statistics and limits */ -func (a *Client) ServiceBrokerHardwareplatformsGet(params *ServiceBrokerHardwareplatformsGetParams) (*ServiceBrokerHardwareplatformsGetOK, error) { +func (a *Client) ServiceBrokerHardwareplatformsGet(params *ServiceBrokerHardwareplatformsGetParams, opts ...ClientOption) (*ServiceBrokerHardwareplatformsGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewServiceBrokerHardwareplatformsGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "serviceBroker.hardwareplatforms.get", Method: "GET", PathPattern: "/broker/v1/hardware-platforms", @@ -44,12 +54,23 @@ func (a *Client) ServiceBrokerHardwareplatformsGet(params *ServiceBrokerHardware Reader: &ServiceBrokerHardwareplatformsGetReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*ServiceBrokerHardwareplatformsGetOK), nil - + success, ok := result.(*ServiceBrokerHardwareplatformsGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for serviceBroker.hardwareplatforms.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } // SetTransport changes the transport on the client diff --git a/power/client/hardware_platforms/service_broker_hardwareplatforms_get_parameters.go b/power/client/hardware_platforms/service_broker_hardwareplatforms_get_parameters.go index 37a62680..53c6aee7 100644 --- a/power/client/hardware_platforms/service_broker_hardwareplatforms_get_parameters.go +++ b/power/client/hardware_platforms/service_broker_hardwareplatforms_get_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewServiceBrokerHardwareplatformsGetParams creates a new ServiceBrokerHardwareplatformsGetParams object -// with the default values initialized. +// NewServiceBrokerHardwareplatformsGetParams creates a new ServiceBrokerHardwareplatformsGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewServiceBrokerHardwareplatformsGetParams() *ServiceBrokerHardwareplatformsGetParams { - var () return &ServiceBrokerHardwareplatformsGetParams{ - timeout: cr.DefaultTimeout, } } // NewServiceBrokerHardwareplatformsGetParamsWithTimeout creates a new ServiceBrokerHardwareplatformsGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewServiceBrokerHardwareplatformsGetParamsWithTimeout(timeout time.Duration) *ServiceBrokerHardwareplatformsGetParams { - var () return &ServiceBrokerHardwareplatformsGetParams{ - timeout: timeout, } } // NewServiceBrokerHardwareplatformsGetParamsWithContext creates a new ServiceBrokerHardwareplatformsGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewServiceBrokerHardwareplatformsGetParamsWithContext(ctx context.Context) *ServiceBrokerHardwareplatformsGetParams { - var () return &ServiceBrokerHardwareplatformsGetParams{ - Context: ctx, } } // NewServiceBrokerHardwareplatformsGetParamsWithHTTPClient creates a new ServiceBrokerHardwareplatformsGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewServiceBrokerHardwareplatformsGetParamsWithHTTPClient(client *http.Client) *ServiceBrokerHardwareplatformsGetParams { - var () return &ServiceBrokerHardwareplatformsGetParams{ HTTPClient: client, } } -/*ServiceBrokerHardwareplatformsGetParams contains all the parameters to send to the API endpoint -for the service broker hardwareplatforms get operation typically these are written to a http.Request +/* ServiceBrokerHardwareplatformsGetParams contains all the parameters to send to the API endpoint + for the service broker hardwareplatforms get operation. + + Typically these are written to a http.Request. */ type ServiceBrokerHardwareplatformsGetParams struct { - /*RegionZone - The region zone of the cloud instance + /* RegionZone. + The region zone of the cloud instance */ RegionZone *string @@ -72,6 +70,21 @@ type ServiceBrokerHardwareplatformsGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the service broker hardwareplatforms get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerHardwareplatformsGetParams) WithDefaults() *ServiceBrokerHardwareplatformsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker hardwareplatforms get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerHardwareplatformsGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the service broker hardwareplatforms get params func (o *ServiceBrokerHardwareplatformsGetParams) WithTimeout(timeout time.Duration) *ServiceBrokerHardwareplatformsGetParams { o.SetTimeout(timeout) @@ -128,16 +141,17 @@ func (o *ServiceBrokerHardwareplatformsGetParams) WriteToRequest(r runtime.Clien // query param regionZone var qrRegionZone string + if o.RegionZone != nil { qrRegionZone = *o.RegionZone } qRegionZone := qrRegionZone if qRegionZone != "" { + if err := r.SetQueryParam("regionZone", qRegionZone); err != nil { return err } } - } if len(res) > 0 { diff --git a/power/client/hardware_platforms/service_broker_hardwareplatforms_get_responses.go b/power/client/hardware_platforms/service_broker_hardwareplatforms_get_responses.go index f981e3ee..41e79c37 100644 --- a/power/client/hardware_platforms/service_broker_hardwareplatforms_get_responses.go +++ b/power/client/hardware_platforms/service_broker_hardwareplatforms_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // ServiceBrokerHardwareplatformsGetReader is a Reader for the ServiceBrokerHardwareplatformsGet structure. @@ -24,23 +23,20 @@ type ServiceBrokerHardwareplatformsGetReader struct { // ReadResponse reads a server response into the received o. func (o *ServiceBrokerHardwareplatformsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewServiceBrokerHardwareplatformsGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 500: result := NewServiceBrokerHardwareplatformsGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -49,7 +45,7 @@ func NewServiceBrokerHardwareplatformsGetOK() *ServiceBrokerHardwareplatformsGet return &ServiceBrokerHardwareplatformsGetOK{} } -/*ServiceBrokerHardwareplatformsGetOK handles this case with default header values. +/* ServiceBrokerHardwareplatformsGetOK describes a response with status code 200, with default header values. OK */ @@ -60,6 +56,9 @@ type ServiceBrokerHardwareplatformsGetOK struct { func (o *ServiceBrokerHardwareplatformsGetOK) Error() string { return fmt.Sprintf("[GET /broker/v1/hardware-platforms][%d] serviceBrokerHardwareplatformsGetOK %+v", 200, o.Payload) } +func (o *ServiceBrokerHardwareplatformsGetOK) GetPayload() models.HardwarePlatforms { + return o.Payload +} func (o *ServiceBrokerHardwareplatformsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -76,7 +75,7 @@ func NewServiceBrokerHardwareplatformsGetInternalServerError() *ServiceBrokerHar return &ServiceBrokerHardwareplatformsGetInternalServerError{} } -/*ServiceBrokerHardwareplatformsGetInternalServerError handles this case with default header values. +/* ServiceBrokerHardwareplatformsGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -87,6 +86,9 @@ type ServiceBrokerHardwareplatformsGetInternalServerError struct { func (o *ServiceBrokerHardwareplatformsGetInternalServerError) Error() string { return fmt.Sprintf("[GET /broker/v1/hardware-platforms][%d] serviceBrokerHardwareplatformsGetInternalServerError %+v", 500, o.Payload) } +func (o *ServiceBrokerHardwareplatformsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerHardwareplatformsGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/iaas_service_broker/iaas_service_broker_client.go b/power/client/iaas_service_broker/iaas_service_broker_client.go index 9fe0ae3a..fee72986 100644 --- a/power/client/iaas_service_broker/iaas_service_broker_client.go +++ b/power/client/iaas_service_broker/iaas_service_broker_client.go @@ -6,13 +6,14 @@ package iaas_service_broker // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/runtime" + "fmt" - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" ) // New creates a new iaas service broker API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { return &Client{transport: transport, formats: formats} } @@ -24,16 +25,31 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + ServiceBrokerHealth(params *ServiceBrokerHealthParams, opts ...ClientOption) (*ServiceBrokerHealthOK, error) + + ServiceBrokerHealthHead(params *ServiceBrokerHealthHeadParams, opts ...ClientOption) (*ServiceBrokerHealthHeadOK, error) + + ServiceBrokerTestTimeout(params *ServiceBrokerTestTimeoutParams, opts ...ClientOption) (*ServiceBrokerTestTimeoutOK, error) + + ServiceBrokerVersion(params *ServiceBrokerVersionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerVersionOK, error) + + SetTransport(transport runtime.ClientTransport) +} + /* -ServiceBrokerHealth gets current server health + ServiceBrokerHealth gets current server health */ -func (a *Client) ServiceBrokerHealth(params *ServiceBrokerHealthParams) (*ServiceBrokerHealthOK, error) { +func (a *Client) ServiceBrokerHealth(params *ServiceBrokerHealthParams, opts ...ClientOption) (*ServiceBrokerHealthOK, error) { // TODO: Validate the params before sending if params == nil { params = NewServiceBrokerHealthParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "serviceBroker.health", Method: "GET", PathPattern: "/broker/v1/health", @@ -44,24 +60,34 @@ func (a *Client) ServiceBrokerHealth(params *ServiceBrokerHealthParams) (*Servic Reader: &ServiceBrokerHealthReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*ServiceBrokerHealthOK), nil - + success, ok := result.(*ServiceBrokerHealthOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for serviceBroker.health: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -ServiceBrokerHealthHead gets current server health + ServiceBrokerHealthHead gets current server health */ -func (a *Client) ServiceBrokerHealthHead(params *ServiceBrokerHealthHeadParams) (*ServiceBrokerHealthHeadOK, error) { +func (a *Client) ServiceBrokerHealthHead(params *ServiceBrokerHealthHeadParams, opts ...ClientOption) (*ServiceBrokerHealthHeadOK, error) { // TODO: Validate the params before sending if params == nil { params = NewServiceBrokerHealthHeadParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "serviceBroker.health.head", Method: "HEAD", PathPattern: "/broker/v1/health", @@ -72,24 +98,34 @@ func (a *Client) ServiceBrokerHealthHead(params *ServiceBrokerHealthHeadParams) Reader: &ServiceBrokerHealthHeadReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*ServiceBrokerHealthHeadOK), nil - + success, ok := result.(*ServiceBrokerHealthHeadOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for serviceBroker.health.head: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -ServiceBrokerTestTimeout gets current server version + ServiceBrokerTestTimeout gets current server version */ -func (a *Client) ServiceBrokerTestTimeout(params *ServiceBrokerTestTimeoutParams) (*ServiceBrokerTestTimeoutOK, error) { +func (a *Client) ServiceBrokerTestTimeout(params *ServiceBrokerTestTimeoutParams, opts ...ClientOption) (*ServiceBrokerTestTimeoutOK, error) { // TODO: Validate the params before sending if params == nil { params = NewServiceBrokerTestTimeoutParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "serviceBroker.test.timeout", Method: "GET", PathPattern: "/broker/v1/test/timeout", @@ -100,24 +136,34 @@ func (a *Client) ServiceBrokerTestTimeout(params *ServiceBrokerTestTimeoutParams Reader: &ServiceBrokerTestTimeoutReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*ServiceBrokerTestTimeoutOK), nil - + success, ok := result.(*ServiceBrokerTestTimeoutOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for serviceBroker.test.timeout: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -ServiceBrokerVersion gets current server version + ServiceBrokerVersion gets current server version */ -func (a *Client) ServiceBrokerVersion(params *ServiceBrokerVersionParams, authInfo runtime.ClientAuthInfoWriter) (*ServiceBrokerVersionOK, error) { +func (a *Client) ServiceBrokerVersion(params *ServiceBrokerVersionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerVersionOK, error) { // TODO: Validate the params before sending if params == nil { params = NewServiceBrokerVersionParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "serviceBroker.version", Method: "GET", PathPattern: "/broker/v1/version", @@ -129,12 +175,23 @@ func (a *Client) ServiceBrokerVersion(params *ServiceBrokerVersionParams, authIn AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*ServiceBrokerVersionOK), nil - + success, ok := result.(*ServiceBrokerVersionOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for serviceBroker.version: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } // SetTransport changes the transport on the client diff --git a/power/client/iaas_service_broker/service_broker_health_head_parameters.go b/power/client/iaas_service_broker/service_broker_health_head_parameters.go index 211325ce..04086695 100644 --- a/power/client/iaas_service_broker/service_broker_health_head_parameters.go +++ b/power/client/iaas_service_broker/service_broker_health_head_parameters.go @@ -13,51 +13,49 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewServiceBrokerHealthHeadParams creates a new ServiceBrokerHealthHeadParams object -// with the default values initialized. +// NewServiceBrokerHealthHeadParams creates a new ServiceBrokerHealthHeadParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewServiceBrokerHealthHeadParams() *ServiceBrokerHealthHeadParams { - return &ServiceBrokerHealthHeadParams{ - timeout: cr.DefaultTimeout, } } // NewServiceBrokerHealthHeadParamsWithTimeout creates a new ServiceBrokerHealthHeadParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewServiceBrokerHealthHeadParamsWithTimeout(timeout time.Duration) *ServiceBrokerHealthHeadParams { - return &ServiceBrokerHealthHeadParams{ - timeout: timeout, } } // NewServiceBrokerHealthHeadParamsWithContext creates a new ServiceBrokerHealthHeadParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewServiceBrokerHealthHeadParamsWithContext(ctx context.Context) *ServiceBrokerHealthHeadParams { - return &ServiceBrokerHealthHeadParams{ - Context: ctx, } } // NewServiceBrokerHealthHeadParamsWithHTTPClient creates a new ServiceBrokerHealthHeadParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewServiceBrokerHealthHeadParamsWithHTTPClient(client *http.Client) *ServiceBrokerHealthHeadParams { - return &ServiceBrokerHealthHeadParams{ HTTPClient: client, } } -/*ServiceBrokerHealthHeadParams contains all the parameters to send to the API endpoint -for the service broker health head operation typically these are written to a http.Request +/* ServiceBrokerHealthHeadParams contains all the parameters to send to the API endpoint + for the service broker health head operation. + + Typically these are written to a http.Request. */ type ServiceBrokerHealthHeadParams struct { timeout time.Duration @@ -65,6 +63,21 @@ type ServiceBrokerHealthHeadParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the service broker health head params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerHealthHeadParams) WithDefaults() *ServiceBrokerHealthHeadParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker health head params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerHealthHeadParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the service broker health head params func (o *ServiceBrokerHealthHeadParams) WithTimeout(timeout time.Duration) *ServiceBrokerHealthHeadParams { o.SetTimeout(timeout) diff --git a/power/client/iaas_service_broker/service_broker_health_head_responses.go b/power/client/iaas_service_broker/service_broker_health_head_responses.go index 880cac0b..3af3bd54 100644 --- a/power/client/iaas_service_broker/service_broker_health_head_responses.go +++ b/power/client/iaas_service_broker/service_broker_health_head_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // ServiceBrokerHealthHeadReader is a Reader for the ServiceBrokerHealthHead structure. @@ -24,23 +23,20 @@ type ServiceBrokerHealthHeadReader struct { // ReadResponse reads a server response into the received o. func (o *ServiceBrokerHealthHeadReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewServiceBrokerHealthHeadOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewServiceBrokerHealthHeadBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -49,7 +45,7 @@ func NewServiceBrokerHealthHeadOK() *ServiceBrokerHealthHeadOK { return &ServiceBrokerHealthHeadOK{} } -/*ServiceBrokerHealthHeadOK handles this case with default header values. +/* ServiceBrokerHealthHeadOK describes a response with status code 200, with default header values. OK */ @@ -60,6 +56,9 @@ type ServiceBrokerHealthHeadOK struct { func (o *ServiceBrokerHealthHeadOK) Error() string { return fmt.Sprintf("[HEAD /broker/v1/health][%d] serviceBrokerHealthHeadOK %+v", 200, o.Payload) } +func (o *ServiceBrokerHealthHeadOK) GetPayload() *models.Health { + return o.Payload +} func (o *ServiceBrokerHealthHeadOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -78,7 +77,7 @@ func NewServiceBrokerHealthHeadBadRequest() *ServiceBrokerHealthHeadBadRequest { return &ServiceBrokerHealthHeadBadRequest{} } -/*ServiceBrokerHealthHeadBadRequest handles this case with default header values. +/* ServiceBrokerHealthHeadBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -89,6 +88,9 @@ type ServiceBrokerHealthHeadBadRequest struct { func (o *ServiceBrokerHealthHeadBadRequest) Error() string { return fmt.Sprintf("[HEAD /broker/v1/health][%d] serviceBrokerHealthHeadBadRequest %+v", 400, o.Payload) } +func (o *ServiceBrokerHealthHeadBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerHealthHeadBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/iaas_service_broker/service_broker_health_parameters.go b/power/client/iaas_service_broker/service_broker_health_parameters.go index f3579815..bed2ea2f 100644 --- a/power/client/iaas_service_broker/service_broker_health_parameters.go +++ b/power/client/iaas_service_broker/service_broker_health_parameters.go @@ -13,51 +13,49 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewServiceBrokerHealthParams creates a new ServiceBrokerHealthParams object -// with the default values initialized. +// NewServiceBrokerHealthParams creates a new ServiceBrokerHealthParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewServiceBrokerHealthParams() *ServiceBrokerHealthParams { - return &ServiceBrokerHealthParams{ - timeout: cr.DefaultTimeout, } } // NewServiceBrokerHealthParamsWithTimeout creates a new ServiceBrokerHealthParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewServiceBrokerHealthParamsWithTimeout(timeout time.Duration) *ServiceBrokerHealthParams { - return &ServiceBrokerHealthParams{ - timeout: timeout, } } // NewServiceBrokerHealthParamsWithContext creates a new ServiceBrokerHealthParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewServiceBrokerHealthParamsWithContext(ctx context.Context) *ServiceBrokerHealthParams { - return &ServiceBrokerHealthParams{ - Context: ctx, } } // NewServiceBrokerHealthParamsWithHTTPClient creates a new ServiceBrokerHealthParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewServiceBrokerHealthParamsWithHTTPClient(client *http.Client) *ServiceBrokerHealthParams { - return &ServiceBrokerHealthParams{ HTTPClient: client, } } -/*ServiceBrokerHealthParams contains all the parameters to send to the API endpoint -for the service broker health operation typically these are written to a http.Request +/* ServiceBrokerHealthParams contains all the parameters to send to the API endpoint + for the service broker health operation. + + Typically these are written to a http.Request. */ type ServiceBrokerHealthParams struct { timeout time.Duration @@ -65,6 +63,21 @@ type ServiceBrokerHealthParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the service broker health params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerHealthParams) WithDefaults() *ServiceBrokerHealthParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker health params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerHealthParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the service broker health params func (o *ServiceBrokerHealthParams) WithTimeout(timeout time.Duration) *ServiceBrokerHealthParams { o.SetTimeout(timeout) diff --git a/power/client/iaas_service_broker/service_broker_health_responses.go b/power/client/iaas_service_broker/service_broker_health_responses.go index 9d9fd8cc..9ad3dd6b 100644 --- a/power/client/iaas_service_broker/service_broker_health_responses.go +++ b/power/client/iaas_service_broker/service_broker_health_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // ServiceBrokerHealthReader is a Reader for the ServiceBrokerHealth structure. @@ -24,23 +23,20 @@ type ServiceBrokerHealthReader struct { // ReadResponse reads a server response into the received o. func (o *ServiceBrokerHealthReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewServiceBrokerHealthOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewServiceBrokerHealthBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -49,7 +45,7 @@ func NewServiceBrokerHealthOK() *ServiceBrokerHealthOK { return &ServiceBrokerHealthOK{} } -/*ServiceBrokerHealthOK handles this case with default header values. +/* ServiceBrokerHealthOK describes a response with status code 200, with default header values. OK */ @@ -60,6 +56,9 @@ type ServiceBrokerHealthOK struct { func (o *ServiceBrokerHealthOK) Error() string { return fmt.Sprintf("[GET /broker/v1/health][%d] serviceBrokerHealthOK %+v", 200, o.Payload) } +func (o *ServiceBrokerHealthOK) GetPayload() *models.Health { + return o.Payload +} func (o *ServiceBrokerHealthOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -78,7 +77,7 @@ func NewServiceBrokerHealthBadRequest() *ServiceBrokerHealthBadRequest { return &ServiceBrokerHealthBadRequest{} } -/*ServiceBrokerHealthBadRequest handles this case with default header values. +/* ServiceBrokerHealthBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -89,6 +88,9 @@ type ServiceBrokerHealthBadRequest struct { func (o *ServiceBrokerHealthBadRequest) Error() string { return fmt.Sprintf("[GET /broker/v1/health][%d] serviceBrokerHealthBadRequest %+v", 400, o.Payload) } +func (o *ServiceBrokerHealthBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerHealthBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/iaas_service_broker/service_broker_test_timeout_parameters.go b/power/client/iaas_service_broker/service_broker_test_timeout_parameters.go index e655336e..aec4dc2a 100644 --- a/power/client/iaas_service_broker/service_broker_test_timeout_parameters.go +++ b/power/client/iaas_service_broker/service_broker_test_timeout_parameters.go @@ -13,58 +13,56 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - - strfmt "github.com/go-openapi/strfmt" ) -// NewServiceBrokerTestTimeoutParams creates a new ServiceBrokerTestTimeoutParams object -// with the default values initialized. +// NewServiceBrokerTestTimeoutParams creates a new ServiceBrokerTestTimeoutParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewServiceBrokerTestTimeoutParams() *ServiceBrokerTestTimeoutParams { - var () return &ServiceBrokerTestTimeoutParams{ - timeout: cr.DefaultTimeout, } } // NewServiceBrokerTestTimeoutParamsWithTimeout creates a new ServiceBrokerTestTimeoutParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewServiceBrokerTestTimeoutParamsWithTimeout(timeout time.Duration) *ServiceBrokerTestTimeoutParams { - var () return &ServiceBrokerTestTimeoutParams{ - timeout: timeout, } } // NewServiceBrokerTestTimeoutParamsWithContext creates a new ServiceBrokerTestTimeoutParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewServiceBrokerTestTimeoutParamsWithContext(ctx context.Context) *ServiceBrokerTestTimeoutParams { - var () return &ServiceBrokerTestTimeoutParams{ - Context: ctx, } } // NewServiceBrokerTestTimeoutParamsWithHTTPClient creates a new ServiceBrokerTestTimeoutParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewServiceBrokerTestTimeoutParamsWithHTTPClient(client *http.Client) *ServiceBrokerTestTimeoutParams { - var () return &ServiceBrokerTestTimeoutParams{ HTTPClient: client, } } -/*ServiceBrokerTestTimeoutParams contains all the parameters to send to the API endpoint -for the service broker test timeout operation typically these are written to a http.Request +/* ServiceBrokerTestTimeoutParams contains all the parameters to send to the API endpoint + for the service broker test timeout operation. + + Typically these are written to a http.Request. */ type ServiceBrokerTestTimeoutParams struct { - /*T - seconds + /* T. + seconds */ T int64 @@ -73,6 +71,21 @@ type ServiceBrokerTestTimeoutParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the service broker test timeout params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerTestTimeoutParams) WithDefaults() *ServiceBrokerTestTimeoutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker test timeout params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerTestTimeoutParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the service broker test timeout params func (o *ServiceBrokerTestTimeoutParams) WithTimeout(timeout time.Duration) *ServiceBrokerTestTimeoutParams { o.SetTimeout(timeout) @@ -129,6 +142,7 @@ func (o *ServiceBrokerTestTimeoutParams) WriteToRequest(r runtime.ClientRequest, qrT := o.T qT := swag.FormatInt64(qrT) if qT != "" { + if err := r.SetQueryParam("t", qT); err != nil { return err } diff --git a/power/client/iaas_service_broker/service_broker_test_timeout_responses.go b/power/client/iaas_service_broker/service_broker_test_timeout_responses.go index 5aa69290..4aee22ea 100644 --- a/power/client/iaas_service_broker/service_broker_test_timeout_responses.go +++ b/power/client/iaas_service_broker/service_broker_test_timeout_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // ServiceBrokerTestTimeoutReader is a Reader for the ServiceBrokerTestTimeout structure. @@ -24,16 +23,14 @@ type ServiceBrokerTestTimeoutReader struct { // ReadResponse reads a server response into the received o. func (o *ServiceBrokerTestTimeoutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewServiceBrokerTestTimeoutOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -42,7 +39,7 @@ func NewServiceBrokerTestTimeoutOK() *ServiceBrokerTestTimeoutOK { return &ServiceBrokerTestTimeoutOK{} } -/*ServiceBrokerTestTimeoutOK handles this case with default header values. +/* ServiceBrokerTestTimeoutOK describes a response with status code 200, with default header values. OK */ @@ -53,6 +50,9 @@ type ServiceBrokerTestTimeoutOK struct { func (o *ServiceBrokerTestTimeoutOK) Error() string { return fmt.Sprintf("[GET /broker/v1/test/timeout][%d] serviceBrokerTestTimeoutOK %+v", 200, o.Payload) } +func (o *ServiceBrokerTestTimeoutOK) GetPayload() models.Object { + return o.Payload +} func (o *ServiceBrokerTestTimeoutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/iaas_service_broker/service_broker_version_parameters.go b/power/client/iaas_service_broker/service_broker_version_parameters.go index 61d0bcb5..6afbe895 100644 --- a/power/client/iaas_service_broker/service_broker_version_parameters.go +++ b/power/client/iaas_service_broker/service_broker_version_parameters.go @@ -13,51 +13,49 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewServiceBrokerVersionParams creates a new ServiceBrokerVersionParams object -// with the default values initialized. +// NewServiceBrokerVersionParams creates a new ServiceBrokerVersionParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewServiceBrokerVersionParams() *ServiceBrokerVersionParams { - return &ServiceBrokerVersionParams{ - timeout: cr.DefaultTimeout, } } // NewServiceBrokerVersionParamsWithTimeout creates a new ServiceBrokerVersionParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewServiceBrokerVersionParamsWithTimeout(timeout time.Duration) *ServiceBrokerVersionParams { - return &ServiceBrokerVersionParams{ - timeout: timeout, } } // NewServiceBrokerVersionParamsWithContext creates a new ServiceBrokerVersionParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewServiceBrokerVersionParamsWithContext(ctx context.Context) *ServiceBrokerVersionParams { - return &ServiceBrokerVersionParams{ - Context: ctx, } } // NewServiceBrokerVersionParamsWithHTTPClient creates a new ServiceBrokerVersionParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewServiceBrokerVersionParamsWithHTTPClient(client *http.Client) *ServiceBrokerVersionParams { - return &ServiceBrokerVersionParams{ HTTPClient: client, } } -/*ServiceBrokerVersionParams contains all the parameters to send to the API endpoint -for the service broker version operation typically these are written to a http.Request +/* ServiceBrokerVersionParams contains all the parameters to send to the API endpoint + for the service broker version operation. + + Typically these are written to a http.Request. */ type ServiceBrokerVersionParams struct { timeout time.Duration @@ -65,6 +63,21 @@ type ServiceBrokerVersionParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the service broker version params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerVersionParams) WithDefaults() *ServiceBrokerVersionParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker version params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerVersionParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the service broker version params func (o *ServiceBrokerVersionParams) WithTimeout(timeout time.Duration) *ServiceBrokerVersionParams { o.SetTimeout(timeout) diff --git a/power/client/iaas_service_broker/service_broker_version_responses.go b/power/client/iaas_service_broker/service_broker_version_responses.go index 452ac817..85c8fc17 100644 --- a/power/client/iaas_service_broker/service_broker_version_responses.go +++ b/power/client/iaas_service_broker/service_broker_version_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // ServiceBrokerVersionReader is a Reader for the ServiceBrokerVersion structure. @@ -24,23 +23,20 @@ type ServiceBrokerVersionReader struct { // ReadResponse reads a server response into the received o. func (o *ServiceBrokerVersionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewServiceBrokerVersionOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewServiceBrokerVersionBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -49,7 +45,7 @@ func NewServiceBrokerVersionOK() *ServiceBrokerVersionOK { return &ServiceBrokerVersionOK{} } -/*ServiceBrokerVersionOK handles this case with default header values. +/* ServiceBrokerVersionOK describes a response with status code 200, with default header values. OK */ @@ -60,6 +56,9 @@ type ServiceBrokerVersionOK struct { func (o *ServiceBrokerVersionOK) Error() string { return fmt.Sprintf("[GET /broker/v1/version][%d] serviceBrokerVersionOK %+v", 200, o.Payload) } +func (o *ServiceBrokerVersionOK) GetPayload() *models.Version { + return o.Payload +} func (o *ServiceBrokerVersionOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -78,7 +77,7 @@ func NewServiceBrokerVersionBadRequest() *ServiceBrokerVersionBadRequest { return &ServiceBrokerVersionBadRequest{} } -/*ServiceBrokerVersionBadRequest handles this case with default header values. +/* ServiceBrokerVersionBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -89,6 +88,9 @@ type ServiceBrokerVersionBadRequest struct { func (o *ServiceBrokerVersionBadRequest) Error() string { return fmt.Sprintf("[GET /broker/v1/version][%d] serviceBrokerVersionBadRequest %+v", 400, o.Payload) } +func (o *ServiceBrokerVersionBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerVersionBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/internal_storage_regions/internal_storage_regions_client.go b/power/client/internal_storage_regions/internal_storage_regions_client.go index 2e619c43..eb44b6d7 100644 --- a/power/client/internal_storage_regions/internal_storage_regions_client.go +++ b/power/client/internal_storage_regions/internal_storage_regions_client.go @@ -6,13 +6,14 @@ package internal_storage_regions // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/runtime" + "fmt" - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" ) // New creates a new internal storage regions API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { return &Client{transport: transport, formats: formats} } @@ -24,16 +25,33 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + InternalV1StorageRegionsStoragePoolsGet(params *InternalV1StorageRegionsStoragePoolsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*InternalV1StorageRegionsStoragePoolsGetOK, error) + + InternalV1StorageRegionsStoragePoolsGetall(params *InternalV1StorageRegionsStoragePoolsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*InternalV1StorageRegionsStoragePoolsGetallOK, error) + + InternalV1StorageRegionsStoragePoolsPut(params *InternalV1StorageRegionsStoragePoolsPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*InternalV1StorageRegionsStoragePoolsPutOK, error) + + InternalV1StorageRegionsThresholdsGet(params *InternalV1StorageRegionsThresholdsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*InternalV1StorageRegionsThresholdsGetOK, error) + + InternalV1StorageRegionsThresholdsPut(params *InternalV1StorageRegionsThresholdsPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*InternalV1StorageRegionsThresholdsPutAccepted, error) + + SetTransport(transport runtime.ClientTransport) +} + /* -InternalV1StorageRegionsStoragePoolsGet gets the settings for given pool name + InternalV1StorageRegionsStoragePoolsGet gets the settings for given pool name */ -func (a *Client) InternalV1StorageRegionsStoragePoolsGet(params *InternalV1StorageRegionsStoragePoolsGetParams, authInfo runtime.ClientAuthInfoWriter) (*InternalV1StorageRegionsStoragePoolsGetOK, error) { +func (a *Client) InternalV1StorageRegionsStoragePoolsGet(params *InternalV1StorageRegionsStoragePoolsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*InternalV1StorageRegionsStoragePoolsGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewInternalV1StorageRegionsStoragePoolsGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "internal.v1.storage.regions.storage-pools.get", Method: "GET", PathPattern: "/internal/v1/storage/regions/{region_zone_id}/storage-pools/{storage_pool_name}", @@ -45,24 +63,34 @@ func (a *Client) InternalV1StorageRegionsStoragePoolsGet(params *InternalV1Stora AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*InternalV1StorageRegionsStoragePoolsGetOK), nil - + success, ok := result.(*InternalV1StorageRegionsStoragePoolsGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for internal.v1.storage.regions.storage-pools.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -InternalV1StorageRegionsStoragePoolsGetall gets the current storage pools settings for a region zone + InternalV1StorageRegionsStoragePoolsGetall gets the current storage pools settings for a region zone */ -func (a *Client) InternalV1StorageRegionsStoragePoolsGetall(params *InternalV1StorageRegionsStoragePoolsGetallParams, authInfo runtime.ClientAuthInfoWriter) (*InternalV1StorageRegionsStoragePoolsGetallOK, error) { +func (a *Client) InternalV1StorageRegionsStoragePoolsGetall(params *InternalV1StorageRegionsStoragePoolsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*InternalV1StorageRegionsStoragePoolsGetallOK, error) { // TODO: Validate the params before sending if params == nil { params = NewInternalV1StorageRegionsStoragePoolsGetallParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "internal.v1.storage.regions.storage-pools.getall", Method: "GET", PathPattern: "/internal/v1/storage/regions/{region_zone_id}/storage-pools", @@ -74,24 +102,34 @@ func (a *Client) InternalV1StorageRegionsStoragePoolsGetall(params *InternalV1St AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*InternalV1StorageRegionsStoragePoolsGetallOK), nil - + success, ok := result.(*InternalV1StorageRegionsStoragePoolsGetallOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for internal.v1.storage.regions.storage-pools.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -InternalV1StorageRegionsStoragePoolsPut updates the settings for given pool name + InternalV1StorageRegionsStoragePoolsPut updates the settings for given pool name */ -func (a *Client) InternalV1StorageRegionsStoragePoolsPut(params *InternalV1StorageRegionsStoragePoolsPutParams, authInfo runtime.ClientAuthInfoWriter) (*InternalV1StorageRegionsStoragePoolsPutOK, error) { +func (a *Client) InternalV1StorageRegionsStoragePoolsPut(params *InternalV1StorageRegionsStoragePoolsPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*InternalV1StorageRegionsStoragePoolsPutOK, error) { // TODO: Validate the params before sending if params == nil { params = NewInternalV1StorageRegionsStoragePoolsPutParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "internal.v1.storage.regions.storage-pools.put", Method: "PUT", PathPattern: "/internal/v1/storage/regions/{region_zone_id}/storage-pools/{storage_pool_name}", @@ -103,24 +141,34 @@ func (a *Client) InternalV1StorageRegionsStoragePoolsPut(params *InternalV1Stora AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*InternalV1StorageRegionsStoragePoolsPutOK), nil - + success, ok := result.(*InternalV1StorageRegionsStoragePoolsPutOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for internal.v1.storage.regions.storage-pools.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -InternalV1StorageRegionsThresholdsGet gets the current default threshold settings for a region zone + InternalV1StorageRegionsThresholdsGet gets the current default threshold settings for a region zone */ -func (a *Client) InternalV1StorageRegionsThresholdsGet(params *InternalV1StorageRegionsThresholdsGetParams, authInfo runtime.ClientAuthInfoWriter) (*InternalV1StorageRegionsThresholdsGetOK, error) { +func (a *Client) InternalV1StorageRegionsThresholdsGet(params *InternalV1StorageRegionsThresholdsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*InternalV1StorageRegionsThresholdsGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewInternalV1StorageRegionsThresholdsGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "internal.v1.storage.regions.thresholds.get", Method: "GET", PathPattern: "/internal/v1/storage/regions/{region_zone_id}/thresholds", @@ -132,24 +180,34 @@ func (a *Client) InternalV1StorageRegionsThresholdsGet(params *InternalV1Storage AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*InternalV1StorageRegionsThresholdsGetOK), nil - + success, ok := result.(*InternalV1StorageRegionsThresholdsGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for internal.v1.storage.regions.thresholds.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -InternalV1StorageRegionsThresholdsPut updates a default threshold setting for a region zone + InternalV1StorageRegionsThresholdsPut updates a default threshold setting for a region zone */ -func (a *Client) InternalV1StorageRegionsThresholdsPut(params *InternalV1StorageRegionsThresholdsPutParams, authInfo runtime.ClientAuthInfoWriter) (*InternalV1StorageRegionsThresholdsPutAccepted, error) { +func (a *Client) InternalV1StorageRegionsThresholdsPut(params *InternalV1StorageRegionsThresholdsPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*InternalV1StorageRegionsThresholdsPutAccepted, error) { // TODO: Validate the params before sending if params == nil { params = NewInternalV1StorageRegionsThresholdsPutParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "internal.v1.storage.regions.thresholds.put", Method: "PUT", PathPattern: "/internal/v1/storage/regions/{region_zone_id}/thresholds", @@ -161,12 +219,23 @@ func (a *Client) InternalV1StorageRegionsThresholdsPut(params *InternalV1Storage AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*InternalV1StorageRegionsThresholdsPutAccepted), nil - + success, ok := result.(*InternalV1StorageRegionsThresholdsPutAccepted) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for internal.v1.storage.regions.thresholds.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } // SetTransport changes the transport on the client diff --git a/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_get_parameters.go b/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_get_parameters.go index 58bfbb30..7f5c37e4 100644 --- a/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_get_parameters.go +++ b/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_get_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewInternalV1StorageRegionsStoragePoolsGetParams creates a new InternalV1StorageRegionsStoragePoolsGetParams object -// with the default values initialized. +// NewInternalV1StorageRegionsStoragePoolsGetParams creates a new InternalV1StorageRegionsStoragePoolsGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewInternalV1StorageRegionsStoragePoolsGetParams() *InternalV1StorageRegionsStoragePoolsGetParams { - var () return &InternalV1StorageRegionsStoragePoolsGetParams{ - timeout: cr.DefaultTimeout, } } // NewInternalV1StorageRegionsStoragePoolsGetParamsWithTimeout creates a new InternalV1StorageRegionsStoragePoolsGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewInternalV1StorageRegionsStoragePoolsGetParamsWithTimeout(timeout time.Duration) *InternalV1StorageRegionsStoragePoolsGetParams { - var () return &InternalV1StorageRegionsStoragePoolsGetParams{ - timeout: timeout, } } // NewInternalV1StorageRegionsStoragePoolsGetParamsWithContext creates a new InternalV1StorageRegionsStoragePoolsGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewInternalV1StorageRegionsStoragePoolsGetParamsWithContext(ctx context.Context) *InternalV1StorageRegionsStoragePoolsGetParams { - var () return &InternalV1StorageRegionsStoragePoolsGetParams{ - Context: ctx, } } // NewInternalV1StorageRegionsStoragePoolsGetParamsWithHTTPClient creates a new InternalV1StorageRegionsStoragePoolsGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewInternalV1StorageRegionsStoragePoolsGetParamsWithHTTPClient(client *http.Client) *InternalV1StorageRegionsStoragePoolsGetParams { - var () return &InternalV1StorageRegionsStoragePoolsGetParams{ HTTPClient: client, } } -/*InternalV1StorageRegionsStoragePoolsGetParams contains all the parameters to send to the API endpoint -for the internal v1 storage regions storage pools get operation typically these are written to a http.Request +/* InternalV1StorageRegionsStoragePoolsGetParams contains all the parameters to send to the API endpoint + for the internal v1 storage regions storage pools get operation. + + Typically these are written to a http.Request. */ type InternalV1StorageRegionsStoragePoolsGetParams struct { - /*RegionZoneID - ID of a Power Cloud Region Zone + /* RegionZoneID. + ID of a Power Cloud Region Zone */ RegionZoneID string - /*StoragePoolName - Storage pool name + /* StoragePoolName. + + Storage pool name */ StoragePoolName string @@ -77,6 +76,21 @@ type InternalV1StorageRegionsStoragePoolsGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the internal v1 storage regions storage pools get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InternalV1StorageRegionsStoragePoolsGetParams) WithDefaults() *InternalV1StorageRegionsStoragePoolsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the internal v1 storage regions storage pools get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InternalV1StorageRegionsStoragePoolsGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the internal v1 storage regions storage pools get params func (o *InternalV1StorageRegionsStoragePoolsGetParams) WithTimeout(timeout time.Duration) *InternalV1StorageRegionsStoragePoolsGetParams { o.SetTimeout(timeout) diff --git a/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_get_responses.go b/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_get_responses.go index f0070f5d..4cb42f88 100644 --- a/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_get_responses.go +++ b/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // InternalV1StorageRegionsStoragePoolsGetReader is a Reader for the InternalV1StorageRegionsStoragePoolsGet structure. @@ -24,37 +23,32 @@ type InternalV1StorageRegionsStoragePoolsGetReader struct { // ReadResponse reads a server response into the received o. func (o *InternalV1StorageRegionsStoragePoolsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewInternalV1StorageRegionsStoragePoolsGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 401: result := NewInternalV1StorageRegionsStoragePoolsGetUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewInternalV1StorageRegionsStoragePoolsGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewInternalV1StorageRegionsStoragePoolsGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -63,7 +57,7 @@ func NewInternalV1StorageRegionsStoragePoolsGetOK() *InternalV1StorageRegionsSto return &InternalV1StorageRegionsStoragePoolsGetOK{} } -/*InternalV1StorageRegionsStoragePoolsGetOK handles this case with default header values. +/* InternalV1StorageRegionsStoragePoolsGetOK describes a response with status code 200, with default header values. OK */ @@ -74,6 +68,9 @@ type InternalV1StorageRegionsStoragePoolsGetOK struct { func (o *InternalV1StorageRegionsStoragePoolsGetOK) Error() string { return fmt.Sprintf("[GET /internal/v1/storage/regions/{region_zone_id}/storage-pools/{storage_pool_name}][%d] internalV1StorageRegionsStoragePoolsGetOK %+v", 200, o.Payload) } +func (o *InternalV1StorageRegionsStoragePoolsGetOK) GetPayload() models.StoragePools { + return o.Payload +} func (o *InternalV1StorageRegionsStoragePoolsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -90,7 +87,7 @@ func NewInternalV1StorageRegionsStoragePoolsGetUnauthorized() *InternalV1Storage return &InternalV1StorageRegionsStoragePoolsGetUnauthorized{} } -/*InternalV1StorageRegionsStoragePoolsGetUnauthorized handles this case with default header values. +/* InternalV1StorageRegionsStoragePoolsGetUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -101,6 +98,9 @@ type InternalV1StorageRegionsStoragePoolsGetUnauthorized struct { func (o *InternalV1StorageRegionsStoragePoolsGetUnauthorized) Error() string { return fmt.Sprintf("[GET /internal/v1/storage/regions/{region_zone_id}/storage-pools/{storage_pool_name}][%d] internalV1StorageRegionsStoragePoolsGetUnauthorized %+v", 401, o.Payload) } +func (o *InternalV1StorageRegionsStoragePoolsGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *InternalV1StorageRegionsStoragePoolsGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -119,7 +119,7 @@ func NewInternalV1StorageRegionsStoragePoolsGetNotFound() *InternalV1StorageRegi return &InternalV1StorageRegionsStoragePoolsGetNotFound{} } -/*InternalV1StorageRegionsStoragePoolsGetNotFound handles this case with default header values. +/* InternalV1StorageRegionsStoragePoolsGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -130,6 +130,9 @@ type InternalV1StorageRegionsStoragePoolsGetNotFound struct { func (o *InternalV1StorageRegionsStoragePoolsGetNotFound) Error() string { return fmt.Sprintf("[GET /internal/v1/storage/regions/{region_zone_id}/storage-pools/{storage_pool_name}][%d] internalV1StorageRegionsStoragePoolsGetNotFound %+v", 404, o.Payload) } +func (o *InternalV1StorageRegionsStoragePoolsGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *InternalV1StorageRegionsStoragePoolsGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -148,7 +151,7 @@ func NewInternalV1StorageRegionsStoragePoolsGetInternalServerError() *InternalV1 return &InternalV1StorageRegionsStoragePoolsGetInternalServerError{} } -/*InternalV1StorageRegionsStoragePoolsGetInternalServerError handles this case with default header values. +/* InternalV1StorageRegionsStoragePoolsGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -159,6 +162,9 @@ type InternalV1StorageRegionsStoragePoolsGetInternalServerError struct { func (o *InternalV1StorageRegionsStoragePoolsGetInternalServerError) Error() string { return fmt.Sprintf("[GET /internal/v1/storage/regions/{region_zone_id}/storage-pools/{storage_pool_name}][%d] internalV1StorageRegionsStoragePoolsGetInternalServerError %+v", 500, o.Payload) } +func (o *InternalV1StorageRegionsStoragePoolsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *InternalV1StorageRegionsStoragePoolsGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_getall_parameters.go b/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_getall_parameters.go index 9b191181..cda5153c 100644 --- a/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_getall_parameters.go +++ b/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_getall_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewInternalV1StorageRegionsStoragePoolsGetallParams creates a new InternalV1StorageRegionsStoragePoolsGetallParams object -// with the default values initialized. +// NewInternalV1StorageRegionsStoragePoolsGetallParams creates a new InternalV1StorageRegionsStoragePoolsGetallParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewInternalV1StorageRegionsStoragePoolsGetallParams() *InternalV1StorageRegionsStoragePoolsGetallParams { - var () return &InternalV1StorageRegionsStoragePoolsGetallParams{ - timeout: cr.DefaultTimeout, } } // NewInternalV1StorageRegionsStoragePoolsGetallParamsWithTimeout creates a new InternalV1StorageRegionsStoragePoolsGetallParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewInternalV1StorageRegionsStoragePoolsGetallParamsWithTimeout(timeout time.Duration) *InternalV1StorageRegionsStoragePoolsGetallParams { - var () return &InternalV1StorageRegionsStoragePoolsGetallParams{ - timeout: timeout, } } // NewInternalV1StorageRegionsStoragePoolsGetallParamsWithContext creates a new InternalV1StorageRegionsStoragePoolsGetallParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewInternalV1StorageRegionsStoragePoolsGetallParamsWithContext(ctx context.Context) *InternalV1StorageRegionsStoragePoolsGetallParams { - var () return &InternalV1StorageRegionsStoragePoolsGetallParams{ - Context: ctx, } } // NewInternalV1StorageRegionsStoragePoolsGetallParamsWithHTTPClient creates a new InternalV1StorageRegionsStoragePoolsGetallParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewInternalV1StorageRegionsStoragePoolsGetallParamsWithHTTPClient(client *http.Client) *InternalV1StorageRegionsStoragePoolsGetallParams { - var () return &InternalV1StorageRegionsStoragePoolsGetallParams{ HTTPClient: client, } } -/*InternalV1StorageRegionsStoragePoolsGetallParams contains all the parameters to send to the API endpoint -for the internal v1 storage regions storage pools getall operation typically these are written to a http.Request +/* InternalV1StorageRegionsStoragePoolsGetallParams contains all the parameters to send to the API endpoint + for the internal v1 storage regions storage pools getall operation. + + Typically these are written to a http.Request. */ type InternalV1StorageRegionsStoragePoolsGetallParams struct { - /*RegionZoneID - ID of a Power Cloud Region Zone + /* RegionZoneID. + ID of a Power Cloud Region Zone */ RegionZoneID string @@ -72,6 +70,21 @@ type InternalV1StorageRegionsStoragePoolsGetallParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the internal v1 storage regions storage pools getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InternalV1StorageRegionsStoragePoolsGetallParams) WithDefaults() *InternalV1StorageRegionsStoragePoolsGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the internal v1 storage regions storage pools getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InternalV1StorageRegionsStoragePoolsGetallParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the internal v1 storage regions storage pools getall params func (o *InternalV1StorageRegionsStoragePoolsGetallParams) WithTimeout(timeout time.Duration) *InternalV1StorageRegionsStoragePoolsGetallParams { o.SetTimeout(timeout) diff --git a/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_getall_responses.go b/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_getall_responses.go index 58bbd836..1c654e2d 100644 --- a/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_getall_responses.go +++ b/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_getall_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // InternalV1StorageRegionsStoragePoolsGetallReader is a Reader for the InternalV1StorageRegionsStoragePoolsGetall structure. @@ -24,37 +23,32 @@ type InternalV1StorageRegionsStoragePoolsGetallReader struct { // ReadResponse reads a server response into the received o. func (o *InternalV1StorageRegionsStoragePoolsGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewInternalV1StorageRegionsStoragePoolsGetallOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 401: result := NewInternalV1StorageRegionsStoragePoolsGetallUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewInternalV1StorageRegionsStoragePoolsGetallNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewInternalV1StorageRegionsStoragePoolsGetallInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -63,7 +57,7 @@ func NewInternalV1StorageRegionsStoragePoolsGetallOK() *InternalV1StorageRegions return &InternalV1StorageRegionsStoragePoolsGetallOK{} } -/*InternalV1StorageRegionsStoragePoolsGetallOK handles this case with default header values. +/* InternalV1StorageRegionsStoragePoolsGetallOK describes a response with status code 200, with default header values. OK */ @@ -74,6 +68,9 @@ type InternalV1StorageRegionsStoragePoolsGetallOK struct { func (o *InternalV1StorageRegionsStoragePoolsGetallOK) Error() string { return fmt.Sprintf("[GET /internal/v1/storage/regions/{region_zone_id}/storage-pools][%d] internalV1StorageRegionsStoragePoolsGetallOK %+v", 200, o.Payload) } +func (o *InternalV1StorageRegionsStoragePoolsGetallOK) GetPayload() models.StoragePools { + return o.Payload +} func (o *InternalV1StorageRegionsStoragePoolsGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -90,7 +87,7 @@ func NewInternalV1StorageRegionsStoragePoolsGetallUnauthorized() *InternalV1Stor return &InternalV1StorageRegionsStoragePoolsGetallUnauthorized{} } -/*InternalV1StorageRegionsStoragePoolsGetallUnauthorized handles this case with default header values. +/* InternalV1StorageRegionsStoragePoolsGetallUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -101,6 +98,9 @@ type InternalV1StorageRegionsStoragePoolsGetallUnauthorized struct { func (o *InternalV1StorageRegionsStoragePoolsGetallUnauthorized) Error() string { return fmt.Sprintf("[GET /internal/v1/storage/regions/{region_zone_id}/storage-pools][%d] internalV1StorageRegionsStoragePoolsGetallUnauthorized %+v", 401, o.Payload) } +func (o *InternalV1StorageRegionsStoragePoolsGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *InternalV1StorageRegionsStoragePoolsGetallUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -119,7 +119,7 @@ func NewInternalV1StorageRegionsStoragePoolsGetallNotFound() *InternalV1StorageR return &InternalV1StorageRegionsStoragePoolsGetallNotFound{} } -/*InternalV1StorageRegionsStoragePoolsGetallNotFound handles this case with default header values. +/* InternalV1StorageRegionsStoragePoolsGetallNotFound describes a response with status code 404, with default header values. Not Found */ @@ -130,6 +130,9 @@ type InternalV1StorageRegionsStoragePoolsGetallNotFound struct { func (o *InternalV1StorageRegionsStoragePoolsGetallNotFound) Error() string { return fmt.Sprintf("[GET /internal/v1/storage/regions/{region_zone_id}/storage-pools][%d] internalV1StorageRegionsStoragePoolsGetallNotFound %+v", 404, o.Payload) } +func (o *InternalV1StorageRegionsStoragePoolsGetallNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *InternalV1StorageRegionsStoragePoolsGetallNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -148,7 +151,7 @@ func NewInternalV1StorageRegionsStoragePoolsGetallInternalServerError() *Interna return &InternalV1StorageRegionsStoragePoolsGetallInternalServerError{} } -/*InternalV1StorageRegionsStoragePoolsGetallInternalServerError handles this case with default header values. +/* InternalV1StorageRegionsStoragePoolsGetallInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -159,6 +162,9 @@ type InternalV1StorageRegionsStoragePoolsGetallInternalServerError struct { func (o *InternalV1StorageRegionsStoragePoolsGetallInternalServerError) Error() string { return fmt.Sprintf("[GET /internal/v1/storage/regions/{region_zone_id}/storage-pools][%d] internalV1StorageRegionsStoragePoolsGetallInternalServerError %+v", 500, o.Payload) } +func (o *InternalV1StorageRegionsStoragePoolsGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *InternalV1StorageRegionsStoragePoolsGetallInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_put_parameters.go b/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_put_parameters.go index 81751aec..624f961b 100644 --- a/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_put_parameters.go +++ b/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_put_parameters.go @@ -13,69 +13,69 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewInternalV1StorageRegionsStoragePoolsPutParams creates a new InternalV1StorageRegionsStoragePoolsPutParams object -// with the default values initialized. +// NewInternalV1StorageRegionsStoragePoolsPutParams creates a new InternalV1StorageRegionsStoragePoolsPutParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewInternalV1StorageRegionsStoragePoolsPutParams() *InternalV1StorageRegionsStoragePoolsPutParams { - var () return &InternalV1StorageRegionsStoragePoolsPutParams{ - timeout: cr.DefaultTimeout, } } // NewInternalV1StorageRegionsStoragePoolsPutParamsWithTimeout creates a new InternalV1StorageRegionsStoragePoolsPutParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewInternalV1StorageRegionsStoragePoolsPutParamsWithTimeout(timeout time.Duration) *InternalV1StorageRegionsStoragePoolsPutParams { - var () return &InternalV1StorageRegionsStoragePoolsPutParams{ - timeout: timeout, } } // NewInternalV1StorageRegionsStoragePoolsPutParamsWithContext creates a new InternalV1StorageRegionsStoragePoolsPutParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewInternalV1StorageRegionsStoragePoolsPutParamsWithContext(ctx context.Context) *InternalV1StorageRegionsStoragePoolsPutParams { - var () return &InternalV1StorageRegionsStoragePoolsPutParams{ - Context: ctx, } } // NewInternalV1StorageRegionsStoragePoolsPutParamsWithHTTPClient creates a new InternalV1StorageRegionsStoragePoolsPutParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewInternalV1StorageRegionsStoragePoolsPutParamsWithHTTPClient(client *http.Client) *InternalV1StorageRegionsStoragePoolsPutParams { - var () return &InternalV1StorageRegionsStoragePoolsPutParams{ HTTPClient: client, } } -/*InternalV1StorageRegionsStoragePoolsPutParams contains all the parameters to send to the API endpoint -for the internal v1 storage regions storage pools put operation typically these are written to a http.Request +/* InternalV1StorageRegionsStoragePoolsPutParams contains all the parameters to send to the API endpoint + for the internal v1 storage regions storage pools put operation. + + Typically these are written to a http.Request. */ type InternalV1StorageRegionsStoragePoolsPutParams struct { - /*Body - Parameters for updating a storage pool + /* Body. + Parameters for updating a storage pool */ Body *models.UpdateStoragePool - /*RegionZoneID - ID of a Power Cloud Region Zone + /* RegionZoneID. + + ID of a Power Cloud Region Zone */ RegionZoneID string - /*StoragePoolName - Storage pool name + /* StoragePoolName. + + Storage pool name */ StoragePoolName string @@ -84,6 +84,21 @@ type InternalV1StorageRegionsStoragePoolsPutParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the internal v1 storage regions storage pools put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InternalV1StorageRegionsStoragePoolsPutParams) WithDefaults() *InternalV1StorageRegionsStoragePoolsPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the internal v1 storage regions storage pools put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InternalV1StorageRegionsStoragePoolsPutParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the internal v1 storage regions storage pools put params func (o *InternalV1StorageRegionsStoragePoolsPutParams) WithTimeout(timeout time.Duration) *InternalV1StorageRegionsStoragePoolsPutParams { o.SetTimeout(timeout) @@ -157,7 +172,6 @@ func (o *InternalV1StorageRegionsStoragePoolsPutParams) WriteToRequest(r runtime return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_put_responses.go b/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_put_responses.go index e869d645..f36b6457 100644 --- a/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_put_responses.go +++ b/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_put_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // InternalV1StorageRegionsStoragePoolsPutReader is a Reader for the InternalV1StorageRegionsStoragePoolsPut structure. @@ -24,44 +23,38 @@ type InternalV1StorageRegionsStoragePoolsPutReader struct { // ReadResponse reads a server response into the received o. func (o *InternalV1StorageRegionsStoragePoolsPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewInternalV1StorageRegionsStoragePoolsPutOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewInternalV1StorageRegionsStoragePoolsPutBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewInternalV1StorageRegionsStoragePoolsPutUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewInternalV1StorageRegionsStoragePoolsPutNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewInternalV1StorageRegionsStoragePoolsPutInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewInternalV1StorageRegionsStoragePoolsPutOK() *InternalV1StorageRegionsSto return &InternalV1StorageRegionsStoragePoolsPutOK{} } -/*InternalV1StorageRegionsStoragePoolsPutOK handles this case with default header values. +/* InternalV1StorageRegionsStoragePoolsPutOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type InternalV1StorageRegionsStoragePoolsPutOK struct { func (o *InternalV1StorageRegionsStoragePoolsPutOK) Error() string { return fmt.Sprintf("[PUT /internal/v1/storage/regions/{region_zone_id}/storage-pools/{storage_pool_name}][%d] internalV1StorageRegionsStoragePoolsPutOK %+v", 200, o.Payload) } +func (o *InternalV1StorageRegionsStoragePoolsPutOK) GetPayload() *models.StoragePool { + return o.Payload +} func (o *InternalV1StorageRegionsStoragePoolsPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewInternalV1StorageRegionsStoragePoolsPutBadRequest() *InternalV1StorageRe return &InternalV1StorageRegionsStoragePoolsPutBadRequest{} } -/*InternalV1StorageRegionsStoragePoolsPutBadRequest handles this case with default header values. +/* InternalV1StorageRegionsStoragePoolsPutBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type InternalV1StorageRegionsStoragePoolsPutBadRequest struct { func (o *InternalV1StorageRegionsStoragePoolsPutBadRequest) Error() string { return fmt.Sprintf("[PUT /internal/v1/storage/regions/{region_zone_id}/storage-pools/{storage_pool_name}][%d] internalV1StorageRegionsStoragePoolsPutBadRequest %+v", 400, o.Payload) } +func (o *InternalV1StorageRegionsStoragePoolsPutBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *InternalV1StorageRegionsStoragePoolsPutBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewInternalV1StorageRegionsStoragePoolsPutUnauthorized() *InternalV1Storage return &InternalV1StorageRegionsStoragePoolsPutUnauthorized{} } -/*InternalV1StorageRegionsStoragePoolsPutUnauthorized handles this case with default header values. +/* InternalV1StorageRegionsStoragePoolsPutUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type InternalV1StorageRegionsStoragePoolsPutUnauthorized struct { func (o *InternalV1StorageRegionsStoragePoolsPutUnauthorized) Error() string { return fmt.Sprintf("[PUT /internal/v1/storage/regions/{region_zone_id}/storage-pools/{storage_pool_name}][%d] internalV1StorageRegionsStoragePoolsPutUnauthorized %+v", 401, o.Payload) } +func (o *InternalV1StorageRegionsStoragePoolsPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *InternalV1StorageRegionsStoragePoolsPutUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewInternalV1StorageRegionsStoragePoolsPutNotFound() *InternalV1StorageRegi return &InternalV1StorageRegionsStoragePoolsPutNotFound{} } -/*InternalV1StorageRegionsStoragePoolsPutNotFound handles this case with default header values. +/* InternalV1StorageRegionsStoragePoolsPutNotFound describes a response with status code 404, with default header values. Not Found */ @@ -168,6 +170,9 @@ type InternalV1StorageRegionsStoragePoolsPutNotFound struct { func (o *InternalV1StorageRegionsStoragePoolsPutNotFound) Error() string { return fmt.Sprintf("[PUT /internal/v1/storage/regions/{region_zone_id}/storage-pools/{storage_pool_name}][%d] internalV1StorageRegionsStoragePoolsPutNotFound %+v", 404, o.Payload) } +func (o *InternalV1StorageRegionsStoragePoolsPutNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *InternalV1StorageRegionsStoragePoolsPutNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewInternalV1StorageRegionsStoragePoolsPutInternalServerError() *InternalV1 return &InternalV1StorageRegionsStoragePoolsPutInternalServerError{} } -/*InternalV1StorageRegionsStoragePoolsPutInternalServerError handles this case with default header values. +/* InternalV1StorageRegionsStoragePoolsPutInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type InternalV1StorageRegionsStoragePoolsPutInternalServerError struct { func (o *InternalV1StorageRegionsStoragePoolsPutInternalServerError) Error() string { return fmt.Sprintf("[PUT /internal/v1/storage/regions/{region_zone_id}/storage-pools/{storage_pool_name}][%d] internalV1StorageRegionsStoragePoolsPutInternalServerError %+v", 500, o.Payload) } +func (o *InternalV1StorageRegionsStoragePoolsPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *InternalV1StorageRegionsStoragePoolsPutInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/internal_storage_regions/internal_v1_storage_regions_thresholds_get_parameters.go b/power/client/internal_storage_regions/internal_v1_storage_regions_thresholds_get_parameters.go index 6cbbf535..c60d4fea 100644 --- a/power/client/internal_storage_regions/internal_v1_storage_regions_thresholds_get_parameters.go +++ b/power/client/internal_storage_regions/internal_v1_storage_regions_thresholds_get_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewInternalV1StorageRegionsThresholdsGetParams creates a new InternalV1StorageRegionsThresholdsGetParams object -// with the default values initialized. +// NewInternalV1StorageRegionsThresholdsGetParams creates a new InternalV1StorageRegionsThresholdsGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewInternalV1StorageRegionsThresholdsGetParams() *InternalV1StorageRegionsThresholdsGetParams { - var () return &InternalV1StorageRegionsThresholdsGetParams{ - timeout: cr.DefaultTimeout, } } // NewInternalV1StorageRegionsThresholdsGetParamsWithTimeout creates a new InternalV1StorageRegionsThresholdsGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewInternalV1StorageRegionsThresholdsGetParamsWithTimeout(timeout time.Duration) *InternalV1StorageRegionsThresholdsGetParams { - var () return &InternalV1StorageRegionsThresholdsGetParams{ - timeout: timeout, } } // NewInternalV1StorageRegionsThresholdsGetParamsWithContext creates a new InternalV1StorageRegionsThresholdsGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewInternalV1StorageRegionsThresholdsGetParamsWithContext(ctx context.Context) *InternalV1StorageRegionsThresholdsGetParams { - var () return &InternalV1StorageRegionsThresholdsGetParams{ - Context: ctx, } } // NewInternalV1StorageRegionsThresholdsGetParamsWithHTTPClient creates a new InternalV1StorageRegionsThresholdsGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewInternalV1StorageRegionsThresholdsGetParamsWithHTTPClient(client *http.Client) *InternalV1StorageRegionsThresholdsGetParams { - var () return &InternalV1StorageRegionsThresholdsGetParams{ HTTPClient: client, } } -/*InternalV1StorageRegionsThresholdsGetParams contains all the parameters to send to the API endpoint -for the internal v1 storage regions thresholds get operation typically these are written to a http.Request +/* InternalV1StorageRegionsThresholdsGetParams contains all the parameters to send to the API endpoint + for the internal v1 storage regions thresholds get operation. + + Typically these are written to a http.Request. */ type InternalV1StorageRegionsThresholdsGetParams struct { - /*RegionZoneID - ID of a Power Cloud Region Zone + /* RegionZoneID. + ID of a Power Cloud Region Zone */ RegionZoneID string @@ -72,6 +70,21 @@ type InternalV1StorageRegionsThresholdsGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the internal v1 storage regions thresholds get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InternalV1StorageRegionsThresholdsGetParams) WithDefaults() *InternalV1StorageRegionsThresholdsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the internal v1 storage regions thresholds get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InternalV1StorageRegionsThresholdsGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the internal v1 storage regions thresholds get params func (o *InternalV1StorageRegionsThresholdsGetParams) WithTimeout(timeout time.Duration) *InternalV1StorageRegionsThresholdsGetParams { o.SetTimeout(timeout) diff --git a/power/client/internal_storage_regions/internal_v1_storage_regions_thresholds_get_responses.go b/power/client/internal_storage_regions/internal_v1_storage_regions_thresholds_get_responses.go index 3db00762..87dbb71e 100644 --- a/power/client/internal_storage_regions/internal_v1_storage_regions_thresholds_get_responses.go +++ b/power/client/internal_storage_regions/internal_v1_storage_regions_thresholds_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // InternalV1StorageRegionsThresholdsGetReader is a Reader for the InternalV1StorageRegionsThresholdsGet structure. @@ -24,37 +23,32 @@ type InternalV1StorageRegionsThresholdsGetReader struct { // ReadResponse reads a server response into the received o. func (o *InternalV1StorageRegionsThresholdsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewInternalV1StorageRegionsThresholdsGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 401: result := NewInternalV1StorageRegionsThresholdsGetUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewInternalV1StorageRegionsThresholdsGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewInternalV1StorageRegionsThresholdsGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -63,7 +57,7 @@ func NewInternalV1StorageRegionsThresholdsGetOK() *InternalV1StorageRegionsThres return &InternalV1StorageRegionsThresholdsGetOK{} } -/*InternalV1StorageRegionsThresholdsGetOK handles this case with default header values. +/* InternalV1StorageRegionsThresholdsGetOK describes a response with status code 200, with default header values. OK */ @@ -74,6 +68,9 @@ type InternalV1StorageRegionsThresholdsGetOK struct { func (o *InternalV1StorageRegionsThresholdsGetOK) Error() string { return fmt.Sprintf("[GET /internal/v1/storage/regions/{region_zone_id}/thresholds][%d] internalV1StorageRegionsThresholdsGetOK %+v", 200, o.Payload) } +func (o *InternalV1StorageRegionsThresholdsGetOK) GetPayload() *models.Thresholds { + return o.Payload +} func (o *InternalV1StorageRegionsThresholdsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -92,7 +89,7 @@ func NewInternalV1StorageRegionsThresholdsGetUnauthorized() *InternalV1StorageRe return &InternalV1StorageRegionsThresholdsGetUnauthorized{} } -/*InternalV1StorageRegionsThresholdsGetUnauthorized handles this case with default header values. +/* InternalV1StorageRegionsThresholdsGetUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -103,6 +100,9 @@ type InternalV1StorageRegionsThresholdsGetUnauthorized struct { func (o *InternalV1StorageRegionsThresholdsGetUnauthorized) Error() string { return fmt.Sprintf("[GET /internal/v1/storage/regions/{region_zone_id}/thresholds][%d] internalV1StorageRegionsThresholdsGetUnauthorized %+v", 401, o.Payload) } +func (o *InternalV1StorageRegionsThresholdsGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *InternalV1StorageRegionsThresholdsGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -121,7 +121,7 @@ func NewInternalV1StorageRegionsThresholdsGetNotFound() *InternalV1StorageRegion return &InternalV1StorageRegionsThresholdsGetNotFound{} } -/*InternalV1StorageRegionsThresholdsGetNotFound handles this case with default header values. +/* InternalV1StorageRegionsThresholdsGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -132,6 +132,9 @@ type InternalV1StorageRegionsThresholdsGetNotFound struct { func (o *InternalV1StorageRegionsThresholdsGetNotFound) Error() string { return fmt.Sprintf("[GET /internal/v1/storage/regions/{region_zone_id}/thresholds][%d] internalV1StorageRegionsThresholdsGetNotFound %+v", 404, o.Payload) } +func (o *InternalV1StorageRegionsThresholdsGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *InternalV1StorageRegionsThresholdsGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -150,7 +153,7 @@ func NewInternalV1StorageRegionsThresholdsGetInternalServerError() *InternalV1St return &InternalV1StorageRegionsThresholdsGetInternalServerError{} } -/*InternalV1StorageRegionsThresholdsGetInternalServerError handles this case with default header values. +/* InternalV1StorageRegionsThresholdsGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -161,6 +164,9 @@ type InternalV1StorageRegionsThresholdsGetInternalServerError struct { func (o *InternalV1StorageRegionsThresholdsGetInternalServerError) Error() string { return fmt.Sprintf("[GET /internal/v1/storage/regions/{region_zone_id}/thresholds][%d] internalV1StorageRegionsThresholdsGetInternalServerError %+v", 500, o.Payload) } +func (o *InternalV1StorageRegionsThresholdsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *InternalV1StorageRegionsThresholdsGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/internal_storage_regions/internal_v1_storage_regions_thresholds_put_parameters.go b/power/client/internal_storage_regions/internal_v1_storage_regions_thresholds_put_parameters.go index 85cd7b53..37d83665 100644 --- a/power/client/internal_storage_regions/internal_v1_storage_regions_thresholds_put_parameters.go +++ b/power/client/internal_storage_regions/internal_v1_storage_regions_thresholds_put_parameters.go @@ -13,64 +13,63 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewInternalV1StorageRegionsThresholdsPutParams creates a new InternalV1StorageRegionsThresholdsPutParams object -// with the default values initialized. +// NewInternalV1StorageRegionsThresholdsPutParams creates a new InternalV1StorageRegionsThresholdsPutParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewInternalV1StorageRegionsThresholdsPutParams() *InternalV1StorageRegionsThresholdsPutParams { - var () return &InternalV1StorageRegionsThresholdsPutParams{ - timeout: cr.DefaultTimeout, } } // NewInternalV1StorageRegionsThresholdsPutParamsWithTimeout creates a new InternalV1StorageRegionsThresholdsPutParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewInternalV1StorageRegionsThresholdsPutParamsWithTimeout(timeout time.Duration) *InternalV1StorageRegionsThresholdsPutParams { - var () return &InternalV1StorageRegionsThresholdsPutParams{ - timeout: timeout, } } // NewInternalV1StorageRegionsThresholdsPutParamsWithContext creates a new InternalV1StorageRegionsThresholdsPutParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewInternalV1StorageRegionsThresholdsPutParamsWithContext(ctx context.Context) *InternalV1StorageRegionsThresholdsPutParams { - var () return &InternalV1StorageRegionsThresholdsPutParams{ - Context: ctx, } } // NewInternalV1StorageRegionsThresholdsPutParamsWithHTTPClient creates a new InternalV1StorageRegionsThresholdsPutParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewInternalV1StorageRegionsThresholdsPutParamsWithHTTPClient(client *http.Client) *InternalV1StorageRegionsThresholdsPutParams { - var () return &InternalV1StorageRegionsThresholdsPutParams{ HTTPClient: client, } } -/*InternalV1StorageRegionsThresholdsPutParams contains all the parameters to send to the API endpoint -for the internal v1 storage regions thresholds put operation typically these are written to a http.Request +/* InternalV1StorageRegionsThresholdsPutParams contains all the parameters to send to the API endpoint + for the internal v1 storage regions thresholds put operation. + + Typically these are written to a http.Request. */ type InternalV1StorageRegionsThresholdsPutParams struct { - /*Body - Parameters for updating default threshold settings for a region-zone + /* Body. + Parameters for updating default threshold settings for a region-zone */ Body *models.Thresholds - /*RegionZoneID - ID of a Power Cloud Region Zone + /* RegionZoneID. + + ID of a Power Cloud Region Zone */ RegionZoneID string @@ -79,6 +78,21 @@ type InternalV1StorageRegionsThresholdsPutParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the internal v1 storage regions thresholds put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InternalV1StorageRegionsThresholdsPutParams) WithDefaults() *InternalV1StorageRegionsThresholdsPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the internal v1 storage regions thresholds put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InternalV1StorageRegionsThresholdsPutParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the internal v1 storage regions thresholds put params func (o *InternalV1StorageRegionsThresholdsPutParams) WithTimeout(timeout time.Duration) *InternalV1StorageRegionsThresholdsPutParams { o.SetTimeout(timeout) @@ -141,7 +155,6 @@ func (o *InternalV1StorageRegionsThresholdsPutParams) WriteToRequest(r runtime.C return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/internal_storage_regions/internal_v1_storage_regions_thresholds_put_responses.go b/power/client/internal_storage_regions/internal_v1_storage_regions_thresholds_put_responses.go index 60c0c14f..fab946ca 100644 --- a/power/client/internal_storage_regions/internal_v1_storage_regions_thresholds_put_responses.go +++ b/power/client/internal_storage_regions/internal_v1_storage_regions_thresholds_put_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // InternalV1StorageRegionsThresholdsPutReader is a Reader for the InternalV1StorageRegionsThresholdsPut structure. @@ -24,58 +23,50 @@ type InternalV1StorageRegionsThresholdsPutReader struct { // ReadResponse reads a server response into the received o. func (o *InternalV1StorageRegionsThresholdsPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 202: result := NewInternalV1StorageRegionsThresholdsPutAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewInternalV1StorageRegionsThresholdsPutBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewInternalV1StorageRegionsThresholdsPutUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 403: result := NewInternalV1StorageRegionsThresholdsPutForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 409: result := NewInternalV1StorageRegionsThresholdsPutConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewInternalV1StorageRegionsThresholdsPutUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewInternalV1StorageRegionsThresholdsPutInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -84,7 +75,7 @@ func NewInternalV1StorageRegionsThresholdsPutAccepted() *InternalV1StorageRegion return &InternalV1StorageRegionsThresholdsPutAccepted{} } -/*InternalV1StorageRegionsThresholdsPutAccepted handles this case with default header values. +/* InternalV1StorageRegionsThresholdsPutAccepted describes a response with status code 202, with default header values. OK, region-zone default threshold settings update */ @@ -95,6 +86,9 @@ type InternalV1StorageRegionsThresholdsPutAccepted struct { func (o *InternalV1StorageRegionsThresholdsPutAccepted) Error() string { return fmt.Sprintf("[PUT /internal/v1/storage/regions/{region_zone_id}/thresholds][%d] internalV1StorageRegionsThresholdsPutAccepted %+v", 202, o.Payload) } +func (o *InternalV1StorageRegionsThresholdsPutAccepted) GetPayload() *models.Thresholds { + return o.Payload +} func (o *InternalV1StorageRegionsThresholdsPutAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -113,7 +107,7 @@ func NewInternalV1StorageRegionsThresholdsPutBadRequest() *InternalV1StorageRegi return &InternalV1StorageRegionsThresholdsPutBadRequest{} } -/*InternalV1StorageRegionsThresholdsPutBadRequest handles this case with default header values. +/* InternalV1StorageRegionsThresholdsPutBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -124,6 +118,9 @@ type InternalV1StorageRegionsThresholdsPutBadRequest struct { func (o *InternalV1StorageRegionsThresholdsPutBadRequest) Error() string { return fmt.Sprintf("[PUT /internal/v1/storage/regions/{region_zone_id}/thresholds][%d] internalV1StorageRegionsThresholdsPutBadRequest %+v", 400, o.Payload) } +func (o *InternalV1StorageRegionsThresholdsPutBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *InternalV1StorageRegionsThresholdsPutBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -142,7 +139,7 @@ func NewInternalV1StorageRegionsThresholdsPutUnauthorized() *InternalV1StorageRe return &InternalV1StorageRegionsThresholdsPutUnauthorized{} } -/*InternalV1StorageRegionsThresholdsPutUnauthorized handles this case with default header values. +/* InternalV1StorageRegionsThresholdsPutUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -153,6 +150,9 @@ type InternalV1StorageRegionsThresholdsPutUnauthorized struct { func (o *InternalV1StorageRegionsThresholdsPutUnauthorized) Error() string { return fmt.Sprintf("[PUT /internal/v1/storage/regions/{region_zone_id}/thresholds][%d] internalV1StorageRegionsThresholdsPutUnauthorized %+v", 401, o.Payload) } +func (o *InternalV1StorageRegionsThresholdsPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *InternalV1StorageRegionsThresholdsPutUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -171,7 +171,7 @@ func NewInternalV1StorageRegionsThresholdsPutForbidden() *InternalV1StorageRegio return &InternalV1StorageRegionsThresholdsPutForbidden{} } -/*InternalV1StorageRegionsThresholdsPutForbidden handles this case with default header values. +/* InternalV1StorageRegionsThresholdsPutForbidden describes a response with status code 403, with default header values. Forbidden */ @@ -182,6 +182,9 @@ type InternalV1StorageRegionsThresholdsPutForbidden struct { func (o *InternalV1StorageRegionsThresholdsPutForbidden) Error() string { return fmt.Sprintf("[PUT /internal/v1/storage/regions/{region_zone_id}/thresholds][%d] internalV1StorageRegionsThresholdsPutForbidden %+v", 403, o.Payload) } +func (o *InternalV1StorageRegionsThresholdsPutForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *InternalV1StorageRegionsThresholdsPutForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -200,7 +203,7 @@ func NewInternalV1StorageRegionsThresholdsPutConflict() *InternalV1StorageRegion return &InternalV1StorageRegionsThresholdsPutConflict{} } -/*InternalV1StorageRegionsThresholdsPutConflict handles this case with default header values. +/* InternalV1StorageRegionsThresholdsPutConflict describes a response with status code 409, with default header values. Conflict */ @@ -211,6 +214,9 @@ type InternalV1StorageRegionsThresholdsPutConflict struct { func (o *InternalV1StorageRegionsThresholdsPutConflict) Error() string { return fmt.Sprintf("[PUT /internal/v1/storage/regions/{region_zone_id}/thresholds][%d] internalV1StorageRegionsThresholdsPutConflict %+v", 409, o.Payload) } +func (o *InternalV1StorageRegionsThresholdsPutConflict) GetPayload() *models.Error { + return o.Payload +} func (o *InternalV1StorageRegionsThresholdsPutConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -229,7 +235,7 @@ func NewInternalV1StorageRegionsThresholdsPutUnprocessableEntity() *InternalV1St return &InternalV1StorageRegionsThresholdsPutUnprocessableEntity{} } -/*InternalV1StorageRegionsThresholdsPutUnprocessableEntity handles this case with default header values. +/* InternalV1StorageRegionsThresholdsPutUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -240,6 +246,9 @@ type InternalV1StorageRegionsThresholdsPutUnprocessableEntity struct { func (o *InternalV1StorageRegionsThresholdsPutUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /internal/v1/storage/regions/{region_zone_id}/thresholds][%d] internalV1StorageRegionsThresholdsPutUnprocessableEntity %+v", 422, o.Payload) } +func (o *InternalV1StorageRegionsThresholdsPutUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *InternalV1StorageRegionsThresholdsPutUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -258,7 +267,7 @@ func NewInternalV1StorageRegionsThresholdsPutInternalServerError() *InternalV1St return &InternalV1StorageRegionsThresholdsPutInternalServerError{} } -/*InternalV1StorageRegionsThresholdsPutInternalServerError handles this case with default header values. +/* InternalV1StorageRegionsThresholdsPutInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -269,6 +278,9 @@ type InternalV1StorageRegionsThresholdsPutInternalServerError struct { func (o *InternalV1StorageRegionsThresholdsPutInternalServerError) Error() string { return fmt.Sprintf("[PUT /internal/v1/storage/regions/{region_zone_id}/thresholds][%d] internalV1StorageRegionsThresholdsPutInternalServerError %+v", 500, o.Payload) } +func (o *InternalV1StorageRegionsThresholdsPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *InternalV1StorageRegionsThresholdsPutInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/open_stacks/open_stacks_client.go b/power/client/open_stacks/open_stacks_client.go index bf6c4edc..693bef3b 100644 --- a/power/client/open_stacks/open_stacks_client.go +++ b/power/client/open_stacks/open_stacks_client.go @@ -6,13 +6,14 @@ package open_stacks // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/runtime" + "fmt" - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" ) // New creates a new open stacks API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { return &Client{transport: transport, formats: formats} } @@ -24,16 +25,33 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + ServiceBrokerOpenstacksGet(params *ServiceBrokerOpenstacksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerOpenstacksGetOK, error) + + ServiceBrokerOpenstacksHostsGet(params *ServiceBrokerOpenstacksHostsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerOpenstacksHostsGetOK, error) + + ServiceBrokerOpenstacksOpenstackGet(params *ServiceBrokerOpenstacksOpenstackGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerOpenstacksOpenstackGetOK, error) + + ServiceBrokerOpenstacksPost(params *ServiceBrokerOpenstacksPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerOpenstacksPostOK, *ServiceBrokerOpenstacksPostCreated, error) + + ServiceBrokerOpenstacksServersGet(params *ServiceBrokerOpenstacksServersGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerOpenstacksServersGetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + /* -ServiceBrokerOpenstacksGet lists all open stack instances being managed + ServiceBrokerOpenstacksGet lists all open stack instances being managed */ -func (a *Client) ServiceBrokerOpenstacksGet(params *ServiceBrokerOpenstacksGetParams, authInfo runtime.ClientAuthInfoWriter) (*ServiceBrokerOpenstacksGetOK, error) { +func (a *Client) ServiceBrokerOpenstacksGet(params *ServiceBrokerOpenstacksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerOpenstacksGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewServiceBrokerOpenstacksGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "serviceBroker.openstacks.get", Method: "GET", PathPattern: "/broker/v1/openstacks", @@ -45,24 +63,34 @@ func (a *Client) ServiceBrokerOpenstacksGet(params *ServiceBrokerOpenstacksGetPa AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*ServiceBrokerOpenstacksGetOK), nil - + success, ok := result.(*ServiceBrokerOpenstacksGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for serviceBroker.openstacks.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -ServiceBrokerOpenstacksHostsGet lists account information for all pvm instances on hostname + ServiceBrokerOpenstacksHostsGet lists account information for all pvm instances on hostname */ -func (a *Client) ServiceBrokerOpenstacksHostsGet(params *ServiceBrokerOpenstacksHostsGetParams, authInfo runtime.ClientAuthInfoWriter) (*ServiceBrokerOpenstacksHostsGetOK, error) { +func (a *Client) ServiceBrokerOpenstacksHostsGet(params *ServiceBrokerOpenstacksHostsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerOpenstacksHostsGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewServiceBrokerOpenstacksHostsGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "serviceBroker.openstacks.hosts.get", Method: "GET", PathPattern: "/broker/v1/openstacks/{openstack_id}/hosts/{hostname}", @@ -74,24 +102,34 @@ func (a *Client) ServiceBrokerOpenstacksHostsGet(params *ServiceBrokerOpenstacks AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*ServiceBrokerOpenstacksHostsGetOK), nil - + success, ok := result.(*ServiceBrokerOpenstacksHostsGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for serviceBroker.openstacks.hosts.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -ServiceBrokerOpenstacksOpenstackGet lists account information for all pvm instances on hostname + ServiceBrokerOpenstacksOpenstackGet lists account information for all pvm instances on hostname */ -func (a *Client) ServiceBrokerOpenstacksOpenstackGet(params *ServiceBrokerOpenstacksOpenstackGetParams, authInfo runtime.ClientAuthInfoWriter) (*ServiceBrokerOpenstacksOpenstackGetOK, error) { +func (a *Client) ServiceBrokerOpenstacksOpenstackGet(params *ServiceBrokerOpenstacksOpenstackGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerOpenstacksOpenstackGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewServiceBrokerOpenstacksOpenstackGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "serviceBroker.openstacks.openstack.get", Method: "GET", PathPattern: "/broker/v1/openstacks/{openstack_id}", @@ -103,24 +141,34 @@ func (a *Client) ServiceBrokerOpenstacksOpenstackGet(params *ServiceBrokerOpenst AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*ServiceBrokerOpenstacksOpenstackGetOK), nil - + success, ok := result.(*ServiceBrokerOpenstacksOpenstackGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for serviceBroker.openstacks.openstack.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -ServiceBrokerOpenstacksPost creates a new open stack instance to be managed + ServiceBrokerOpenstacksPost creates a new open stack instance to be managed */ -func (a *Client) ServiceBrokerOpenstacksPost(params *ServiceBrokerOpenstacksPostParams, authInfo runtime.ClientAuthInfoWriter) (*ServiceBrokerOpenstacksPostOK, *ServiceBrokerOpenstacksPostCreated, error) { +func (a *Client) ServiceBrokerOpenstacksPost(params *ServiceBrokerOpenstacksPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerOpenstacksPostOK, *ServiceBrokerOpenstacksPostCreated, error) { // TODO: Validate the params before sending if params == nil { params = NewServiceBrokerOpenstacksPostParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "serviceBroker.openstacks.post", Method: "POST", PathPattern: "/broker/v1/openstacks", @@ -132,7 +180,12 @@ func (a *Client) ServiceBrokerOpenstacksPost(params *ServiceBrokerOpenstacksPost AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, nil, err } @@ -142,20 +195,20 @@ func (a *Client) ServiceBrokerOpenstacksPost(params *ServiceBrokerOpenstacksPost case *ServiceBrokerOpenstacksPostCreated: return nil, value, nil } - return nil, nil, nil - + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for open_stacks: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -ServiceBrokerOpenstacksServersGet lists account information for a pvm instance + ServiceBrokerOpenstacksServersGet lists account information for a pvm instance */ -func (a *Client) ServiceBrokerOpenstacksServersGet(params *ServiceBrokerOpenstacksServersGetParams, authInfo runtime.ClientAuthInfoWriter) (*ServiceBrokerOpenstacksServersGetOK, error) { +func (a *Client) ServiceBrokerOpenstacksServersGet(params *ServiceBrokerOpenstacksServersGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerOpenstacksServersGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewServiceBrokerOpenstacksServersGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "serviceBroker.openstacks.servers.get", Method: "GET", PathPattern: "/broker/v1/openstacks/{openstack_id}/servers/{pvm_instance_id}", @@ -167,12 +220,23 @@ func (a *Client) ServiceBrokerOpenstacksServersGet(params *ServiceBrokerOpenstac AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*ServiceBrokerOpenstacksServersGetOK), nil - + success, ok := result.(*ServiceBrokerOpenstacksServersGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for serviceBroker.openstacks.servers.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } // SetTransport changes the transport on the client diff --git a/power/client/open_stacks/service_broker_openstacks_get_parameters.go b/power/client/open_stacks/service_broker_openstacks_get_parameters.go index 6e9fa9b9..a5fc89bf 100644 --- a/power/client/open_stacks/service_broker_openstacks_get_parameters.go +++ b/power/client/open_stacks/service_broker_openstacks_get_parameters.go @@ -13,51 +13,49 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewServiceBrokerOpenstacksGetParams creates a new ServiceBrokerOpenstacksGetParams object -// with the default values initialized. +// NewServiceBrokerOpenstacksGetParams creates a new ServiceBrokerOpenstacksGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewServiceBrokerOpenstacksGetParams() *ServiceBrokerOpenstacksGetParams { - return &ServiceBrokerOpenstacksGetParams{ - timeout: cr.DefaultTimeout, } } // NewServiceBrokerOpenstacksGetParamsWithTimeout creates a new ServiceBrokerOpenstacksGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewServiceBrokerOpenstacksGetParamsWithTimeout(timeout time.Duration) *ServiceBrokerOpenstacksGetParams { - return &ServiceBrokerOpenstacksGetParams{ - timeout: timeout, } } // NewServiceBrokerOpenstacksGetParamsWithContext creates a new ServiceBrokerOpenstacksGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewServiceBrokerOpenstacksGetParamsWithContext(ctx context.Context) *ServiceBrokerOpenstacksGetParams { - return &ServiceBrokerOpenstacksGetParams{ - Context: ctx, } } // NewServiceBrokerOpenstacksGetParamsWithHTTPClient creates a new ServiceBrokerOpenstacksGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewServiceBrokerOpenstacksGetParamsWithHTTPClient(client *http.Client) *ServiceBrokerOpenstacksGetParams { - return &ServiceBrokerOpenstacksGetParams{ HTTPClient: client, } } -/*ServiceBrokerOpenstacksGetParams contains all the parameters to send to the API endpoint -for the service broker openstacks get operation typically these are written to a http.Request +/* ServiceBrokerOpenstacksGetParams contains all the parameters to send to the API endpoint + for the service broker openstacks get operation. + + Typically these are written to a http.Request. */ type ServiceBrokerOpenstacksGetParams struct { timeout time.Duration @@ -65,6 +63,21 @@ type ServiceBrokerOpenstacksGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the service broker openstacks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerOpenstacksGetParams) WithDefaults() *ServiceBrokerOpenstacksGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker openstacks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerOpenstacksGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the service broker openstacks get params func (o *ServiceBrokerOpenstacksGetParams) WithTimeout(timeout time.Duration) *ServiceBrokerOpenstacksGetParams { o.SetTimeout(timeout) diff --git a/power/client/open_stacks/service_broker_openstacks_get_responses.go b/power/client/open_stacks/service_broker_openstacks_get_responses.go index d37d1514..c1903411 100644 --- a/power/client/open_stacks/service_broker_openstacks_get_responses.go +++ b/power/client/open_stacks/service_broker_openstacks_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // ServiceBrokerOpenstacksGetReader is a Reader for the ServiceBrokerOpenstacksGet structure. @@ -24,37 +23,32 @@ type ServiceBrokerOpenstacksGetReader struct { // ReadResponse reads a server response into the received o. func (o *ServiceBrokerOpenstacksGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewServiceBrokerOpenstacksGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewServiceBrokerOpenstacksGetBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 403: result := NewServiceBrokerOpenstacksGetForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewServiceBrokerOpenstacksGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -63,7 +57,7 @@ func NewServiceBrokerOpenstacksGetOK() *ServiceBrokerOpenstacksGetOK { return &ServiceBrokerOpenstacksGetOK{} } -/*ServiceBrokerOpenstacksGetOK handles this case with default header values. +/* ServiceBrokerOpenstacksGetOK describes a response with status code 200, with default header values. OK */ @@ -74,6 +68,9 @@ type ServiceBrokerOpenstacksGetOK struct { func (o *ServiceBrokerOpenstacksGetOK) Error() string { return fmt.Sprintf("[GET /broker/v1/openstacks][%d] serviceBrokerOpenstacksGetOK %+v", 200, o.Payload) } +func (o *ServiceBrokerOpenstacksGetOK) GetPayload() *models.OpenStacks { + return o.Payload +} func (o *ServiceBrokerOpenstacksGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -92,7 +89,7 @@ func NewServiceBrokerOpenstacksGetBadRequest() *ServiceBrokerOpenstacksGetBadReq return &ServiceBrokerOpenstacksGetBadRequest{} } -/*ServiceBrokerOpenstacksGetBadRequest handles this case with default header values. +/* ServiceBrokerOpenstacksGetBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -103,6 +100,9 @@ type ServiceBrokerOpenstacksGetBadRequest struct { func (o *ServiceBrokerOpenstacksGetBadRequest) Error() string { return fmt.Sprintf("[GET /broker/v1/openstacks][%d] serviceBrokerOpenstacksGetBadRequest %+v", 400, o.Payload) } +func (o *ServiceBrokerOpenstacksGetBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerOpenstacksGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -121,7 +121,7 @@ func NewServiceBrokerOpenstacksGetForbidden() *ServiceBrokerOpenstacksGetForbidd return &ServiceBrokerOpenstacksGetForbidden{} } -/*ServiceBrokerOpenstacksGetForbidden handles this case with default header values. +/* ServiceBrokerOpenstacksGetForbidden describes a response with status code 403, with default header values. Unauthorized */ @@ -132,6 +132,9 @@ type ServiceBrokerOpenstacksGetForbidden struct { func (o *ServiceBrokerOpenstacksGetForbidden) Error() string { return fmt.Sprintf("[GET /broker/v1/openstacks][%d] serviceBrokerOpenstacksGetForbidden %+v", 403, o.Payload) } +func (o *ServiceBrokerOpenstacksGetForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerOpenstacksGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -150,7 +153,7 @@ func NewServiceBrokerOpenstacksGetInternalServerError() *ServiceBrokerOpenstacks return &ServiceBrokerOpenstacksGetInternalServerError{} } -/*ServiceBrokerOpenstacksGetInternalServerError handles this case with default header values. +/* ServiceBrokerOpenstacksGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -161,6 +164,9 @@ type ServiceBrokerOpenstacksGetInternalServerError struct { func (o *ServiceBrokerOpenstacksGetInternalServerError) Error() string { return fmt.Sprintf("[GET /broker/v1/openstacks][%d] serviceBrokerOpenstacksGetInternalServerError %+v", 500, o.Payload) } +func (o *ServiceBrokerOpenstacksGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerOpenstacksGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/open_stacks/service_broker_openstacks_hosts_get_parameters.go b/power/client/open_stacks/service_broker_openstacks_hosts_get_parameters.go index fdacc2ce..0f29aa65 100644 --- a/power/client/open_stacks/service_broker_openstacks_hosts_get_parameters.go +++ b/power/client/open_stacks/service_broker_openstacks_hosts_get_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewServiceBrokerOpenstacksHostsGetParams creates a new ServiceBrokerOpenstacksHostsGetParams object -// with the default values initialized. +// NewServiceBrokerOpenstacksHostsGetParams creates a new ServiceBrokerOpenstacksHostsGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewServiceBrokerOpenstacksHostsGetParams() *ServiceBrokerOpenstacksHostsGetParams { - var () return &ServiceBrokerOpenstacksHostsGetParams{ - timeout: cr.DefaultTimeout, } } // NewServiceBrokerOpenstacksHostsGetParamsWithTimeout creates a new ServiceBrokerOpenstacksHostsGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewServiceBrokerOpenstacksHostsGetParamsWithTimeout(timeout time.Duration) *ServiceBrokerOpenstacksHostsGetParams { - var () return &ServiceBrokerOpenstacksHostsGetParams{ - timeout: timeout, } } // NewServiceBrokerOpenstacksHostsGetParamsWithContext creates a new ServiceBrokerOpenstacksHostsGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewServiceBrokerOpenstacksHostsGetParamsWithContext(ctx context.Context) *ServiceBrokerOpenstacksHostsGetParams { - var () return &ServiceBrokerOpenstacksHostsGetParams{ - Context: ctx, } } // NewServiceBrokerOpenstacksHostsGetParamsWithHTTPClient creates a new ServiceBrokerOpenstacksHostsGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewServiceBrokerOpenstacksHostsGetParamsWithHTTPClient(client *http.Client) *ServiceBrokerOpenstacksHostsGetParams { - var () return &ServiceBrokerOpenstacksHostsGetParams{ HTTPClient: client, } } -/*ServiceBrokerOpenstacksHostsGetParams contains all the parameters to send to the API endpoint -for the service broker openstacks hosts get operation typically these are written to a http.Request +/* ServiceBrokerOpenstacksHostsGetParams contains all the parameters to send to the API endpoint + for the service broker openstacks hosts get operation. + + Typically these are written to a http.Request. */ type ServiceBrokerOpenstacksHostsGetParams struct { - /*Hostname - Hostname + /* Hostname. + Hostname */ Hostname string - /*OpenstackID - Openstack ID + /* OpenstackID. + + Openstack ID */ OpenstackID string @@ -77,6 +76,21 @@ type ServiceBrokerOpenstacksHostsGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the service broker openstacks hosts get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerOpenstacksHostsGetParams) WithDefaults() *ServiceBrokerOpenstacksHostsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker openstacks hosts get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerOpenstacksHostsGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the service broker openstacks hosts get params func (o *ServiceBrokerOpenstacksHostsGetParams) WithTimeout(timeout time.Duration) *ServiceBrokerOpenstacksHostsGetParams { o.SetTimeout(timeout) diff --git a/power/client/open_stacks/service_broker_openstacks_hosts_get_responses.go b/power/client/open_stacks/service_broker_openstacks_hosts_get_responses.go index e747dff7..83eff4cf 100644 --- a/power/client/open_stacks/service_broker_openstacks_hosts_get_responses.go +++ b/power/client/open_stacks/service_broker_openstacks_hosts_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // ServiceBrokerOpenstacksHostsGetReader is a Reader for the ServiceBrokerOpenstacksHostsGet structure. @@ -24,37 +23,32 @@ type ServiceBrokerOpenstacksHostsGetReader struct { // ReadResponse reads a server response into the received o. func (o *ServiceBrokerOpenstacksHostsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewServiceBrokerOpenstacksHostsGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewServiceBrokerOpenstacksHostsGetBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewServiceBrokerOpenstacksHostsGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewServiceBrokerOpenstacksHostsGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -63,7 +57,7 @@ func NewServiceBrokerOpenstacksHostsGetOK() *ServiceBrokerOpenstacksHostsGetOK { return &ServiceBrokerOpenstacksHostsGetOK{} } -/*ServiceBrokerOpenstacksHostsGetOK handles this case with default header values. +/* ServiceBrokerOpenstacksHostsGetOK describes a response with status code 200, with default header values. OK */ @@ -74,6 +68,9 @@ type ServiceBrokerOpenstacksHostsGetOK struct { func (o *ServiceBrokerOpenstacksHostsGetOK) Error() string { return fmt.Sprintf("[GET /broker/v1/openstacks/{openstack_id}/hosts/{hostname}][%d] serviceBrokerOpenstacksHostsGetOK %+v", 200, o.Payload) } +func (o *ServiceBrokerOpenstacksHostsGetOK) GetPayload() *models.HostInfo { + return o.Payload +} func (o *ServiceBrokerOpenstacksHostsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -92,7 +89,7 @@ func NewServiceBrokerOpenstacksHostsGetBadRequest() *ServiceBrokerOpenstacksHost return &ServiceBrokerOpenstacksHostsGetBadRequest{} } -/*ServiceBrokerOpenstacksHostsGetBadRequest handles this case with default header values. +/* ServiceBrokerOpenstacksHostsGetBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -103,6 +100,9 @@ type ServiceBrokerOpenstacksHostsGetBadRequest struct { func (o *ServiceBrokerOpenstacksHostsGetBadRequest) Error() string { return fmt.Sprintf("[GET /broker/v1/openstacks/{openstack_id}/hosts/{hostname}][%d] serviceBrokerOpenstacksHostsGetBadRequest %+v", 400, o.Payload) } +func (o *ServiceBrokerOpenstacksHostsGetBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerOpenstacksHostsGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -121,7 +121,7 @@ func NewServiceBrokerOpenstacksHostsGetNotFound() *ServiceBrokerOpenstacksHostsG return &ServiceBrokerOpenstacksHostsGetNotFound{} } -/*ServiceBrokerOpenstacksHostsGetNotFound handles this case with default header values. +/* ServiceBrokerOpenstacksHostsGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -132,6 +132,9 @@ type ServiceBrokerOpenstacksHostsGetNotFound struct { func (o *ServiceBrokerOpenstacksHostsGetNotFound) Error() string { return fmt.Sprintf("[GET /broker/v1/openstacks/{openstack_id}/hosts/{hostname}][%d] serviceBrokerOpenstacksHostsGetNotFound %+v", 404, o.Payload) } +func (o *ServiceBrokerOpenstacksHostsGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerOpenstacksHostsGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -150,7 +153,7 @@ func NewServiceBrokerOpenstacksHostsGetInternalServerError() *ServiceBrokerOpens return &ServiceBrokerOpenstacksHostsGetInternalServerError{} } -/*ServiceBrokerOpenstacksHostsGetInternalServerError handles this case with default header values. +/* ServiceBrokerOpenstacksHostsGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -161,6 +164,9 @@ type ServiceBrokerOpenstacksHostsGetInternalServerError struct { func (o *ServiceBrokerOpenstacksHostsGetInternalServerError) Error() string { return fmt.Sprintf("[GET /broker/v1/openstacks/{openstack_id}/hosts/{hostname}][%d] serviceBrokerOpenstacksHostsGetInternalServerError %+v", 500, o.Payload) } +func (o *ServiceBrokerOpenstacksHostsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerOpenstacksHostsGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/open_stacks/service_broker_openstacks_openstack_get_parameters.go b/power/client/open_stacks/service_broker_openstacks_openstack_get_parameters.go index 4bcf4ee0..11249b70 100644 --- a/power/client/open_stacks/service_broker_openstacks_openstack_get_parameters.go +++ b/power/client/open_stacks/service_broker_openstacks_openstack_get_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewServiceBrokerOpenstacksOpenstackGetParams creates a new ServiceBrokerOpenstacksOpenstackGetParams object -// with the default values initialized. +// NewServiceBrokerOpenstacksOpenstackGetParams creates a new ServiceBrokerOpenstacksOpenstackGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewServiceBrokerOpenstacksOpenstackGetParams() *ServiceBrokerOpenstacksOpenstackGetParams { - var () return &ServiceBrokerOpenstacksOpenstackGetParams{ - timeout: cr.DefaultTimeout, } } // NewServiceBrokerOpenstacksOpenstackGetParamsWithTimeout creates a new ServiceBrokerOpenstacksOpenstackGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewServiceBrokerOpenstacksOpenstackGetParamsWithTimeout(timeout time.Duration) *ServiceBrokerOpenstacksOpenstackGetParams { - var () return &ServiceBrokerOpenstacksOpenstackGetParams{ - timeout: timeout, } } // NewServiceBrokerOpenstacksOpenstackGetParamsWithContext creates a new ServiceBrokerOpenstacksOpenstackGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewServiceBrokerOpenstacksOpenstackGetParamsWithContext(ctx context.Context) *ServiceBrokerOpenstacksOpenstackGetParams { - var () return &ServiceBrokerOpenstacksOpenstackGetParams{ - Context: ctx, } } // NewServiceBrokerOpenstacksOpenstackGetParamsWithHTTPClient creates a new ServiceBrokerOpenstacksOpenstackGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewServiceBrokerOpenstacksOpenstackGetParamsWithHTTPClient(client *http.Client) *ServiceBrokerOpenstacksOpenstackGetParams { - var () return &ServiceBrokerOpenstacksOpenstackGetParams{ HTTPClient: client, } } -/*ServiceBrokerOpenstacksOpenstackGetParams contains all the parameters to send to the API endpoint -for the service broker openstacks openstack get operation typically these are written to a http.Request +/* ServiceBrokerOpenstacksOpenstackGetParams contains all the parameters to send to the API endpoint + for the service broker openstacks openstack get operation. + + Typically these are written to a http.Request. */ type ServiceBrokerOpenstacksOpenstackGetParams struct { - /*OpenstackID - Openstack ID + /* OpenstackID. + Openstack ID */ OpenstackID string @@ -72,6 +70,21 @@ type ServiceBrokerOpenstacksOpenstackGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the service broker openstacks openstack get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerOpenstacksOpenstackGetParams) WithDefaults() *ServiceBrokerOpenstacksOpenstackGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker openstacks openstack get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerOpenstacksOpenstackGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the service broker openstacks openstack get params func (o *ServiceBrokerOpenstacksOpenstackGetParams) WithTimeout(timeout time.Duration) *ServiceBrokerOpenstacksOpenstackGetParams { o.SetTimeout(timeout) diff --git a/power/client/open_stacks/service_broker_openstacks_openstack_get_responses.go b/power/client/open_stacks/service_broker_openstacks_openstack_get_responses.go index b427be39..dece779e 100644 --- a/power/client/open_stacks/service_broker_openstacks_openstack_get_responses.go +++ b/power/client/open_stacks/service_broker_openstacks_openstack_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // ServiceBrokerOpenstacksOpenstackGetReader is a Reader for the ServiceBrokerOpenstacksOpenstackGet structure. @@ -24,37 +23,32 @@ type ServiceBrokerOpenstacksOpenstackGetReader struct { // ReadResponse reads a server response into the received o. func (o *ServiceBrokerOpenstacksOpenstackGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewServiceBrokerOpenstacksOpenstackGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewServiceBrokerOpenstacksOpenstackGetBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewServiceBrokerOpenstacksOpenstackGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewServiceBrokerOpenstacksOpenstackGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -63,7 +57,7 @@ func NewServiceBrokerOpenstacksOpenstackGetOK() *ServiceBrokerOpenstacksOpenstac return &ServiceBrokerOpenstacksOpenstackGetOK{} } -/*ServiceBrokerOpenstacksOpenstackGetOK handles this case with default header values. +/* ServiceBrokerOpenstacksOpenstackGetOK describes a response with status code 200, with default header values. OK */ @@ -74,6 +68,9 @@ type ServiceBrokerOpenstacksOpenstackGetOK struct { func (o *ServiceBrokerOpenstacksOpenstackGetOK) Error() string { return fmt.Sprintf("[GET /broker/v1/openstacks/{openstack_id}][%d] serviceBrokerOpenstacksOpenstackGetOK %+v", 200, o.Payload) } +func (o *ServiceBrokerOpenstacksOpenstackGetOK) GetPayload() *models.OpenStackInfo { + return o.Payload +} func (o *ServiceBrokerOpenstacksOpenstackGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -92,7 +89,7 @@ func NewServiceBrokerOpenstacksOpenstackGetBadRequest() *ServiceBrokerOpenstacks return &ServiceBrokerOpenstacksOpenstackGetBadRequest{} } -/*ServiceBrokerOpenstacksOpenstackGetBadRequest handles this case with default header values. +/* ServiceBrokerOpenstacksOpenstackGetBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -103,6 +100,9 @@ type ServiceBrokerOpenstacksOpenstackGetBadRequest struct { func (o *ServiceBrokerOpenstacksOpenstackGetBadRequest) Error() string { return fmt.Sprintf("[GET /broker/v1/openstacks/{openstack_id}][%d] serviceBrokerOpenstacksOpenstackGetBadRequest %+v", 400, o.Payload) } +func (o *ServiceBrokerOpenstacksOpenstackGetBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerOpenstacksOpenstackGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -121,7 +121,7 @@ func NewServiceBrokerOpenstacksOpenstackGetNotFound() *ServiceBrokerOpenstacksOp return &ServiceBrokerOpenstacksOpenstackGetNotFound{} } -/*ServiceBrokerOpenstacksOpenstackGetNotFound handles this case with default header values. +/* ServiceBrokerOpenstacksOpenstackGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -132,6 +132,9 @@ type ServiceBrokerOpenstacksOpenstackGetNotFound struct { func (o *ServiceBrokerOpenstacksOpenstackGetNotFound) Error() string { return fmt.Sprintf("[GET /broker/v1/openstacks/{openstack_id}][%d] serviceBrokerOpenstacksOpenstackGetNotFound %+v", 404, o.Payload) } +func (o *ServiceBrokerOpenstacksOpenstackGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerOpenstacksOpenstackGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -150,7 +153,7 @@ func NewServiceBrokerOpenstacksOpenstackGetInternalServerError() *ServiceBrokerO return &ServiceBrokerOpenstacksOpenstackGetInternalServerError{} } -/*ServiceBrokerOpenstacksOpenstackGetInternalServerError handles this case with default header values. +/* ServiceBrokerOpenstacksOpenstackGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -161,6 +164,9 @@ type ServiceBrokerOpenstacksOpenstackGetInternalServerError struct { func (o *ServiceBrokerOpenstacksOpenstackGetInternalServerError) Error() string { return fmt.Sprintf("[GET /broker/v1/openstacks/{openstack_id}][%d] serviceBrokerOpenstacksOpenstackGetInternalServerError %+v", 500, o.Payload) } +func (o *ServiceBrokerOpenstacksOpenstackGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerOpenstacksOpenstackGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/open_stacks/service_broker_openstacks_post_parameters.go b/power/client/open_stacks/service_broker_openstacks_post_parameters.go index b505aa4b..32935216 100644 --- a/power/client/open_stacks/service_broker_openstacks_post_parameters.go +++ b/power/client/open_stacks/service_broker_openstacks_post_parameters.go @@ -13,59 +13,57 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewServiceBrokerOpenstacksPostParams creates a new ServiceBrokerOpenstacksPostParams object -// with the default values initialized. +// NewServiceBrokerOpenstacksPostParams creates a new ServiceBrokerOpenstacksPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewServiceBrokerOpenstacksPostParams() *ServiceBrokerOpenstacksPostParams { - var () return &ServiceBrokerOpenstacksPostParams{ - timeout: cr.DefaultTimeout, } } // NewServiceBrokerOpenstacksPostParamsWithTimeout creates a new ServiceBrokerOpenstacksPostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewServiceBrokerOpenstacksPostParamsWithTimeout(timeout time.Duration) *ServiceBrokerOpenstacksPostParams { - var () return &ServiceBrokerOpenstacksPostParams{ - timeout: timeout, } } // NewServiceBrokerOpenstacksPostParamsWithContext creates a new ServiceBrokerOpenstacksPostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewServiceBrokerOpenstacksPostParamsWithContext(ctx context.Context) *ServiceBrokerOpenstacksPostParams { - var () return &ServiceBrokerOpenstacksPostParams{ - Context: ctx, } } // NewServiceBrokerOpenstacksPostParamsWithHTTPClient creates a new ServiceBrokerOpenstacksPostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewServiceBrokerOpenstacksPostParamsWithHTTPClient(client *http.Client) *ServiceBrokerOpenstacksPostParams { - var () return &ServiceBrokerOpenstacksPostParams{ HTTPClient: client, } } -/*ServiceBrokerOpenstacksPostParams contains all the parameters to send to the API endpoint -for the service broker openstacks post operation typically these are written to a http.Request +/* ServiceBrokerOpenstacksPostParams contains all the parameters to send to the API endpoint + for the service broker openstacks post operation. + + Typically these are written to a http.Request. */ type ServiceBrokerOpenstacksPostParams struct { - /*Body - Parameters for the creation of a new Open Stack Instance + /* Body. + Parameters for the creation of a new Open Stack Instance */ Body *models.OpenStackCreate @@ -74,6 +72,21 @@ type ServiceBrokerOpenstacksPostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the service broker openstacks post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerOpenstacksPostParams) WithDefaults() *ServiceBrokerOpenstacksPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker openstacks post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerOpenstacksPostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the service broker openstacks post params func (o *ServiceBrokerOpenstacksPostParams) WithTimeout(timeout time.Duration) *ServiceBrokerOpenstacksPostParams { o.SetTimeout(timeout) @@ -125,7 +138,6 @@ func (o *ServiceBrokerOpenstacksPostParams) WriteToRequest(r runtime.ClientReque return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/open_stacks/service_broker_openstacks_post_responses.go b/power/client/open_stacks/service_broker_openstacks_post_responses.go index 99a18430..b83e9e39 100644 --- a/power/client/open_stacks/service_broker_openstacks_post_responses.go +++ b/power/client/open_stacks/service_broker_openstacks_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // ServiceBrokerOpenstacksPostReader is a Reader for the ServiceBrokerOpenstacksPost structure. @@ -24,51 +23,44 @@ type ServiceBrokerOpenstacksPostReader struct { // ReadResponse reads a server response into the received o. func (o *ServiceBrokerOpenstacksPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewServiceBrokerOpenstacksPostOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 201: result := NewServiceBrokerOpenstacksPostCreated() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewServiceBrokerOpenstacksPostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 409: result := NewServiceBrokerOpenstacksPostConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewServiceBrokerOpenstacksPostUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewServiceBrokerOpenstacksPostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -77,7 +69,7 @@ func NewServiceBrokerOpenstacksPostOK() *ServiceBrokerOpenstacksPostOK { return &ServiceBrokerOpenstacksPostOK{} } -/*ServiceBrokerOpenstacksPostOK handles this case with default header values. +/* ServiceBrokerOpenstacksPostOK describes a response with status code 200, with default header values. OK */ @@ -88,6 +80,9 @@ type ServiceBrokerOpenstacksPostOK struct { func (o *ServiceBrokerOpenstacksPostOK) Error() string { return fmt.Sprintf("[POST /broker/v1/openstacks][%d] serviceBrokerOpenstacksPostOK %+v", 200, o.Payload) } +func (o *ServiceBrokerOpenstacksPostOK) GetPayload() *models.OpenStack { + return o.Payload +} func (o *ServiceBrokerOpenstacksPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -106,7 +101,7 @@ func NewServiceBrokerOpenstacksPostCreated() *ServiceBrokerOpenstacksPostCreated return &ServiceBrokerOpenstacksPostCreated{} } -/*ServiceBrokerOpenstacksPostCreated handles this case with default header values. +/* ServiceBrokerOpenstacksPostCreated describes a response with status code 201, with default header values. Created */ @@ -117,6 +112,9 @@ type ServiceBrokerOpenstacksPostCreated struct { func (o *ServiceBrokerOpenstacksPostCreated) Error() string { return fmt.Sprintf("[POST /broker/v1/openstacks][%d] serviceBrokerOpenstacksPostCreated %+v", 201, o.Payload) } +func (o *ServiceBrokerOpenstacksPostCreated) GetPayload() *models.OpenStack { + return o.Payload +} func (o *ServiceBrokerOpenstacksPostCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -135,7 +133,7 @@ func NewServiceBrokerOpenstacksPostBadRequest() *ServiceBrokerOpenstacksPostBadR return &ServiceBrokerOpenstacksPostBadRequest{} } -/*ServiceBrokerOpenstacksPostBadRequest handles this case with default header values. +/* ServiceBrokerOpenstacksPostBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -146,6 +144,9 @@ type ServiceBrokerOpenstacksPostBadRequest struct { func (o *ServiceBrokerOpenstacksPostBadRequest) Error() string { return fmt.Sprintf("[POST /broker/v1/openstacks][%d] serviceBrokerOpenstacksPostBadRequest %+v", 400, o.Payload) } +func (o *ServiceBrokerOpenstacksPostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerOpenstacksPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -164,7 +165,7 @@ func NewServiceBrokerOpenstacksPostConflict() *ServiceBrokerOpenstacksPostConfli return &ServiceBrokerOpenstacksPostConflict{} } -/*ServiceBrokerOpenstacksPostConflict handles this case with default header values. +/* ServiceBrokerOpenstacksPostConflict describes a response with status code 409, with default header values. Conflict */ @@ -175,6 +176,9 @@ type ServiceBrokerOpenstacksPostConflict struct { func (o *ServiceBrokerOpenstacksPostConflict) Error() string { return fmt.Sprintf("[POST /broker/v1/openstacks][%d] serviceBrokerOpenstacksPostConflict %+v", 409, o.Payload) } +func (o *ServiceBrokerOpenstacksPostConflict) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerOpenstacksPostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -193,7 +197,7 @@ func NewServiceBrokerOpenstacksPostUnprocessableEntity() *ServiceBrokerOpenstack return &ServiceBrokerOpenstacksPostUnprocessableEntity{} } -/*ServiceBrokerOpenstacksPostUnprocessableEntity handles this case with default header values. +/* ServiceBrokerOpenstacksPostUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -204,6 +208,9 @@ type ServiceBrokerOpenstacksPostUnprocessableEntity struct { func (o *ServiceBrokerOpenstacksPostUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /broker/v1/openstacks][%d] serviceBrokerOpenstacksPostUnprocessableEntity %+v", 422, o.Payload) } +func (o *ServiceBrokerOpenstacksPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerOpenstacksPostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -222,7 +229,7 @@ func NewServiceBrokerOpenstacksPostInternalServerError() *ServiceBrokerOpenstack return &ServiceBrokerOpenstacksPostInternalServerError{} } -/*ServiceBrokerOpenstacksPostInternalServerError handles this case with default header values. +/* ServiceBrokerOpenstacksPostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -233,6 +240,9 @@ type ServiceBrokerOpenstacksPostInternalServerError struct { func (o *ServiceBrokerOpenstacksPostInternalServerError) Error() string { return fmt.Sprintf("[POST /broker/v1/openstacks][%d] serviceBrokerOpenstacksPostInternalServerError %+v", 500, o.Payload) } +func (o *ServiceBrokerOpenstacksPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerOpenstacksPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/open_stacks/service_broker_openstacks_servers_get_parameters.go b/power/client/open_stacks/service_broker_openstacks_servers_get_parameters.go index 9143ff59..dbe1a1a5 100644 --- a/power/client/open_stacks/service_broker_openstacks_servers_get_parameters.go +++ b/power/client/open_stacks/service_broker_openstacks_servers_get_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewServiceBrokerOpenstacksServersGetParams creates a new ServiceBrokerOpenstacksServersGetParams object -// with the default values initialized. +// NewServiceBrokerOpenstacksServersGetParams creates a new ServiceBrokerOpenstacksServersGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewServiceBrokerOpenstacksServersGetParams() *ServiceBrokerOpenstacksServersGetParams { - var () return &ServiceBrokerOpenstacksServersGetParams{ - timeout: cr.DefaultTimeout, } } // NewServiceBrokerOpenstacksServersGetParamsWithTimeout creates a new ServiceBrokerOpenstacksServersGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewServiceBrokerOpenstacksServersGetParamsWithTimeout(timeout time.Duration) *ServiceBrokerOpenstacksServersGetParams { - var () return &ServiceBrokerOpenstacksServersGetParams{ - timeout: timeout, } } // NewServiceBrokerOpenstacksServersGetParamsWithContext creates a new ServiceBrokerOpenstacksServersGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewServiceBrokerOpenstacksServersGetParamsWithContext(ctx context.Context) *ServiceBrokerOpenstacksServersGetParams { - var () return &ServiceBrokerOpenstacksServersGetParams{ - Context: ctx, } } // NewServiceBrokerOpenstacksServersGetParamsWithHTTPClient creates a new ServiceBrokerOpenstacksServersGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewServiceBrokerOpenstacksServersGetParamsWithHTTPClient(client *http.Client) *ServiceBrokerOpenstacksServersGetParams { - var () return &ServiceBrokerOpenstacksServersGetParams{ HTTPClient: client, } } -/*ServiceBrokerOpenstacksServersGetParams contains all the parameters to send to the API endpoint -for the service broker openstacks servers get operation typically these are written to a http.Request +/* ServiceBrokerOpenstacksServersGetParams contains all the parameters to send to the API endpoint + for the service broker openstacks servers get operation. + + Typically these are written to a http.Request. */ type ServiceBrokerOpenstacksServersGetParams struct { - /*OpenstackID - Openstack ID + /* OpenstackID. + Openstack ID */ OpenstackID string - /*PvmInstanceID - PCloud PVM Instance ID + /* PvmInstanceID. + + PCloud PVM Instance ID */ PvmInstanceID string @@ -77,6 +76,21 @@ type ServiceBrokerOpenstacksServersGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the service broker openstacks servers get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerOpenstacksServersGetParams) WithDefaults() *ServiceBrokerOpenstacksServersGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker openstacks servers get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerOpenstacksServersGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the service broker openstacks servers get params func (o *ServiceBrokerOpenstacksServersGetParams) WithTimeout(timeout time.Duration) *ServiceBrokerOpenstacksServersGetParams { o.SetTimeout(timeout) diff --git a/power/client/open_stacks/service_broker_openstacks_servers_get_responses.go b/power/client/open_stacks/service_broker_openstacks_servers_get_responses.go index 90126033..d52ebc75 100644 --- a/power/client/open_stacks/service_broker_openstacks_servers_get_responses.go +++ b/power/client/open_stacks/service_broker_openstacks_servers_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // ServiceBrokerOpenstacksServersGetReader is a Reader for the ServiceBrokerOpenstacksServersGet structure. @@ -24,37 +23,32 @@ type ServiceBrokerOpenstacksServersGetReader struct { // ReadResponse reads a server response into the received o. func (o *ServiceBrokerOpenstacksServersGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewServiceBrokerOpenstacksServersGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewServiceBrokerOpenstacksServersGetBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewServiceBrokerOpenstacksServersGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewServiceBrokerOpenstacksServersGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -63,7 +57,7 @@ func NewServiceBrokerOpenstacksServersGetOK() *ServiceBrokerOpenstacksServersGet return &ServiceBrokerOpenstacksServersGetOK{} } -/*ServiceBrokerOpenstacksServersGetOK handles this case with default header values. +/* ServiceBrokerOpenstacksServersGetOK describes a response with status code 200, with default header values. OK */ @@ -74,6 +68,9 @@ type ServiceBrokerOpenstacksServersGetOK struct { func (o *ServiceBrokerOpenstacksServersGetOK) Error() string { return fmt.Sprintf("[GET /broker/v1/openstacks/{openstack_id}/servers/{pvm_instance_id}][%d] serviceBrokerOpenstacksServersGetOK %+v", 200, o.Payload) } +func (o *ServiceBrokerOpenstacksServersGetOK) GetPayload() *models.HostPVMInstance { + return o.Payload +} func (o *ServiceBrokerOpenstacksServersGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -92,7 +89,7 @@ func NewServiceBrokerOpenstacksServersGetBadRequest() *ServiceBrokerOpenstacksSe return &ServiceBrokerOpenstacksServersGetBadRequest{} } -/*ServiceBrokerOpenstacksServersGetBadRequest handles this case with default header values. +/* ServiceBrokerOpenstacksServersGetBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -103,6 +100,9 @@ type ServiceBrokerOpenstacksServersGetBadRequest struct { func (o *ServiceBrokerOpenstacksServersGetBadRequest) Error() string { return fmt.Sprintf("[GET /broker/v1/openstacks/{openstack_id}/servers/{pvm_instance_id}][%d] serviceBrokerOpenstacksServersGetBadRequest %+v", 400, o.Payload) } +func (o *ServiceBrokerOpenstacksServersGetBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerOpenstacksServersGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -121,7 +121,7 @@ func NewServiceBrokerOpenstacksServersGetNotFound() *ServiceBrokerOpenstacksServ return &ServiceBrokerOpenstacksServersGetNotFound{} } -/*ServiceBrokerOpenstacksServersGetNotFound handles this case with default header values. +/* ServiceBrokerOpenstacksServersGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -132,6 +132,9 @@ type ServiceBrokerOpenstacksServersGetNotFound struct { func (o *ServiceBrokerOpenstacksServersGetNotFound) Error() string { return fmt.Sprintf("[GET /broker/v1/openstacks/{openstack_id}/servers/{pvm_instance_id}][%d] serviceBrokerOpenstacksServersGetNotFound %+v", 404, o.Payload) } +func (o *ServiceBrokerOpenstacksServersGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerOpenstacksServersGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -150,7 +153,7 @@ func NewServiceBrokerOpenstacksServersGetInternalServerError() *ServiceBrokerOpe return &ServiceBrokerOpenstacksServersGetInternalServerError{} } -/*ServiceBrokerOpenstacksServersGetInternalServerError handles this case with default header values. +/* ServiceBrokerOpenstacksServersGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -161,6 +164,9 @@ type ServiceBrokerOpenstacksServersGetInternalServerError struct { func (o *ServiceBrokerOpenstacksServersGetInternalServerError) Error() string { return fmt.Sprintf("[GET /broker/v1/openstacks/{openstack_id}/servers/{pvm_instance_id}][%d] serviceBrokerOpenstacksServersGetInternalServerError %+v", 500, o.Payload) } +func (o *ServiceBrokerOpenstacksServersGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerOpenstacksServersGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_cloud_connections/p_cloud_cloud_connections_client.go b/power/client/p_cloud_cloud_connections/p_cloud_cloud_connections_client.go index 6cf9dc61..6b3a5437 100644 --- a/power/client/p_cloud_cloud_connections/p_cloud_cloud_connections_client.go +++ b/power/client/p_cloud_cloud_connections/p_cloud_cloud_connections_client.go @@ -6,13 +6,14 @@ package p_cloud_cloud_connections // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/runtime" + "fmt" - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" ) // New creates a new p cloud cloud connections API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { return &Client{transport: transport, formats: formats} } @@ -24,16 +25,39 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudCloudconnectionsDelete(params *PcloudCloudconnectionsDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudconnectionsDeleteOK, *PcloudCloudconnectionsDeleteAccepted, error) + + PcloudCloudconnectionsGet(params *PcloudCloudconnectionsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudconnectionsGetOK, error) + + PcloudCloudconnectionsGetall(params *PcloudCloudconnectionsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudconnectionsGetallOK, error) + + PcloudCloudconnectionsNetworksDelete(params *PcloudCloudconnectionsNetworksDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudconnectionsNetworksDeleteOK, *PcloudCloudconnectionsNetworksDeleteAccepted, error) + + PcloudCloudconnectionsNetworksPut(params *PcloudCloudconnectionsNetworksPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudconnectionsNetworksPutOK, *PcloudCloudconnectionsNetworksPutAccepted, error) + + PcloudCloudconnectionsPost(params *PcloudCloudconnectionsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudconnectionsPostOK, *PcloudCloudconnectionsPostCreated, *PcloudCloudconnectionsPostAccepted, error) + + PcloudCloudconnectionsPut(params *PcloudCloudconnectionsPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudconnectionsPutOK, *PcloudCloudconnectionsPutAccepted, error) + + PcloudCloudconnectionsVirtualprivatecloudsGetall(params *PcloudCloudconnectionsVirtualprivatecloudsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudconnectionsVirtualprivatecloudsGetallOK, error) + + SetTransport(transport runtime.ClientTransport) +} + /* -PcloudCloudconnectionsDelete deletes a cloud connection + PcloudCloudconnectionsDelete deletes a cloud connection */ -func (a *Client) PcloudCloudconnectionsDelete(params *PcloudCloudconnectionsDeleteParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudCloudconnectionsDeleteOK, *PcloudCloudconnectionsDeleteAccepted, error) { +func (a *Client) PcloudCloudconnectionsDelete(params *PcloudCloudconnectionsDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudconnectionsDeleteOK, *PcloudCloudconnectionsDeleteAccepted, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudCloudconnectionsDeleteParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.cloudconnections.delete", Method: "DELETE", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}", @@ -45,7 +69,12 @@ func (a *Client) PcloudCloudconnectionsDelete(params *PcloudCloudconnectionsDele AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, nil, err } @@ -55,20 +84,20 @@ func (a *Client) PcloudCloudconnectionsDelete(params *PcloudCloudconnectionsDele case *PcloudCloudconnectionsDeleteAccepted: return nil, value, nil } - return nil, nil, nil - + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for p_cloud_cloud_connections: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudCloudconnectionsGet gets a cloud connection s state information + PcloudCloudconnectionsGet gets a cloud connection s state information */ -func (a *Client) PcloudCloudconnectionsGet(params *PcloudCloudconnectionsGetParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudCloudconnectionsGetOK, error) { +func (a *Client) PcloudCloudconnectionsGet(params *PcloudCloudconnectionsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudconnectionsGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudCloudconnectionsGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.cloudconnections.get", Method: "GET", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}", @@ -80,24 +109,34 @@ func (a *Client) PcloudCloudconnectionsGet(params *PcloudCloudconnectionsGetPara AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudCloudconnectionsGetOK), nil - + success, ok := result.(*PcloudCloudconnectionsGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.cloudconnections.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudCloudconnectionsGetall gets all cloud connections in this cloud instance + PcloudCloudconnectionsGetall gets all cloud connections in this cloud instance */ -func (a *Client) PcloudCloudconnectionsGetall(params *PcloudCloudconnectionsGetallParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudCloudconnectionsGetallOK, error) { +func (a *Client) PcloudCloudconnectionsGetall(params *PcloudCloudconnectionsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudconnectionsGetallOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudCloudconnectionsGetallParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.cloudconnections.getall", Method: "GET", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections", @@ -109,24 +148,34 @@ func (a *Client) PcloudCloudconnectionsGetall(params *PcloudCloudconnectionsGeta AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudCloudconnectionsGetallOK), nil - + success, ok := result.(*PcloudCloudconnectionsGetallOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.cloudconnections.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudCloudconnectionsNetworksDelete deletes a network from a cloud connection + PcloudCloudconnectionsNetworksDelete deletes a network from a cloud connection */ -func (a *Client) PcloudCloudconnectionsNetworksDelete(params *PcloudCloudconnectionsNetworksDeleteParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudCloudconnectionsNetworksDeleteOK, *PcloudCloudconnectionsNetworksDeleteAccepted, error) { +func (a *Client) PcloudCloudconnectionsNetworksDelete(params *PcloudCloudconnectionsNetworksDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudconnectionsNetworksDeleteOK, *PcloudCloudconnectionsNetworksDeleteAccepted, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudCloudconnectionsNetworksDeleteParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.cloudconnections.networks.delete", Method: "DELETE", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}/networks/{network_id}", @@ -138,7 +187,12 @@ func (a *Client) PcloudCloudconnectionsNetworksDelete(params *PcloudCloudconnect AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, nil, err } @@ -148,20 +202,20 @@ func (a *Client) PcloudCloudconnectionsNetworksDelete(params *PcloudCloudconnect case *PcloudCloudconnectionsNetworksDeleteAccepted: return nil, value, nil } - return nil, nil, nil - + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for p_cloud_cloud_connections: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudCloudconnectionsNetworksPut adds a network to the cloud connection + PcloudCloudconnectionsNetworksPut adds a network to the cloud connection */ -func (a *Client) PcloudCloudconnectionsNetworksPut(params *PcloudCloudconnectionsNetworksPutParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudCloudconnectionsNetworksPutOK, *PcloudCloudconnectionsNetworksPutAccepted, error) { +func (a *Client) PcloudCloudconnectionsNetworksPut(params *PcloudCloudconnectionsNetworksPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudconnectionsNetworksPutOK, *PcloudCloudconnectionsNetworksPutAccepted, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudCloudconnectionsNetworksPutParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.cloudconnections.networks.put", Method: "PUT", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}/networks/{network_id}", @@ -173,7 +227,12 @@ func (a *Client) PcloudCloudconnectionsNetworksPut(params *PcloudCloudconnection AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, nil, err } @@ -183,20 +242,20 @@ func (a *Client) PcloudCloudconnectionsNetworksPut(params *PcloudCloudconnection case *PcloudCloudconnectionsNetworksPutAccepted: return nil, value, nil } - return nil, nil, nil - + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for p_cloud_cloud_connections: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudCloudconnectionsPost creates a new cloud connection + PcloudCloudconnectionsPost creates a new cloud connection */ -func (a *Client) PcloudCloudconnectionsPost(params *PcloudCloudconnectionsPostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudCloudconnectionsPostOK, *PcloudCloudconnectionsPostCreated, *PcloudCloudconnectionsPostAccepted, error) { +func (a *Client) PcloudCloudconnectionsPost(params *PcloudCloudconnectionsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudconnectionsPostOK, *PcloudCloudconnectionsPostCreated, *PcloudCloudconnectionsPostAccepted, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudCloudconnectionsPostParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.cloudconnections.post", Method: "POST", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections", @@ -208,7 +267,12 @@ func (a *Client) PcloudCloudconnectionsPost(params *PcloudCloudconnectionsPostPa AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, nil, nil, err } @@ -220,20 +284,20 @@ func (a *Client) PcloudCloudconnectionsPost(params *PcloudCloudconnectionsPostPa case *PcloudCloudconnectionsPostAccepted: return nil, nil, value, nil } - return nil, nil, nil, nil - + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for p_cloud_cloud_connections: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudCloudconnectionsPut updates a cloud connection + PcloudCloudconnectionsPut updates a cloud connection */ -func (a *Client) PcloudCloudconnectionsPut(params *PcloudCloudconnectionsPutParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudCloudconnectionsPutOK, *PcloudCloudconnectionsPutAccepted, error) { +func (a *Client) PcloudCloudconnectionsPut(params *PcloudCloudconnectionsPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudconnectionsPutOK, *PcloudCloudconnectionsPutAccepted, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudCloudconnectionsPutParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.cloudconnections.put", Method: "PUT", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}", @@ -245,7 +309,12 @@ func (a *Client) PcloudCloudconnectionsPut(params *PcloudCloudconnectionsPutPara AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, nil, err } @@ -255,20 +324,20 @@ func (a *Client) PcloudCloudconnectionsPut(params *PcloudCloudconnectionsPutPara case *PcloudCloudconnectionsPutAccepted: return nil, value, nil } - return nil, nil, nil - + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for p_cloud_cloud_connections: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudCloudconnectionsVirtualprivatecloudsGetall gets all virtual private cloud connections in this cloud instance + PcloudCloudconnectionsVirtualprivatecloudsGetall gets all virtual private cloud connections in this cloud instance */ -func (a *Client) PcloudCloudconnectionsVirtualprivatecloudsGetall(params *PcloudCloudconnectionsVirtualprivatecloudsGetallParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudCloudconnectionsVirtualprivatecloudsGetallOK, error) { +func (a *Client) PcloudCloudconnectionsVirtualprivatecloudsGetall(params *PcloudCloudconnectionsVirtualprivatecloudsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudconnectionsVirtualprivatecloudsGetallOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudCloudconnectionsVirtualprivatecloudsGetallParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.cloudconnections.virtualprivateclouds.getall", Method: "GET", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections-virtual-private-clouds", @@ -280,12 +349,23 @@ func (a *Client) PcloudCloudconnectionsVirtualprivatecloudsGetall(params *Pcloud AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudCloudconnectionsVirtualprivatecloudsGetallOK), nil - + success, ok := result.(*PcloudCloudconnectionsVirtualprivatecloudsGetallOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.cloudconnections.virtualprivateclouds.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } // SetTransport changes the transport on the client diff --git a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_delete_parameters.go b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_delete_parameters.go index 8e2157b5..9cbc14c9 100644 --- a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_delete_parameters.go +++ b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_delete_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudCloudconnectionsDeleteParams creates a new PcloudCloudconnectionsDeleteParams object -// with the default values initialized. +// NewPcloudCloudconnectionsDeleteParams creates a new PcloudCloudconnectionsDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudCloudconnectionsDeleteParams() *PcloudCloudconnectionsDeleteParams { - var () return &PcloudCloudconnectionsDeleteParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudCloudconnectionsDeleteParamsWithTimeout creates a new PcloudCloudconnectionsDeleteParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudCloudconnectionsDeleteParamsWithTimeout(timeout time.Duration) *PcloudCloudconnectionsDeleteParams { - var () return &PcloudCloudconnectionsDeleteParams{ - timeout: timeout, } } // NewPcloudCloudconnectionsDeleteParamsWithContext creates a new PcloudCloudconnectionsDeleteParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudCloudconnectionsDeleteParamsWithContext(ctx context.Context) *PcloudCloudconnectionsDeleteParams { - var () return &PcloudCloudconnectionsDeleteParams{ - Context: ctx, } } // NewPcloudCloudconnectionsDeleteParamsWithHTTPClient creates a new PcloudCloudconnectionsDeleteParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudCloudconnectionsDeleteParamsWithHTTPClient(client *http.Client) *PcloudCloudconnectionsDeleteParams { - var () return &PcloudCloudconnectionsDeleteParams{ HTTPClient: client, } } -/*PcloudCloudconnectionsDeleteParams contains all the parameters to send to the API endpoint -for the pcloud cloudconnections delete operation typically these are written to a http.Request +/* PcloudCloudconnectionsDeleteParams contains all the parameters to send to the API endpoint + for the pcloud cloudconnections delete operation. + + Typically these are written to a http.Request. */ type PcloudCloudconnectionsDeleteParams struct { - /*CloudConnectionID - Cloud Connection ID + /* CloudConnectionID. + Cloud Connection ID */ CloudConnectionID string - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -77,6 +76,21 @@ type PcloudCloudconnectionsDeleteParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud cloudconnections delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudconnectionsDeleteParams) WithDefaults() *PcloudCloudconnectionsDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudconnections delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudconnectionsDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud cloudconnections delete params func (o *PcloudCloudconnectionsDeleteParams) WithTimeout(timeout time.Duration) *PcloudCloudconnectionsDeleteParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_delete_responses.go b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_delete_responses.go index 8d295e3f..6d5d1c69 100644 --- a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_delete_responses.go +++ b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_delete_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudCloudconnectionsDeleteReader is a Reader for the PcloudCloudconnectionsDelete structure. @@ -24,51 +23,44 @@ type PcloudCloudconnectionsDeleteReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudCloudconnectionsDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudCloudconnectionsDeleteOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 202: result := NewPcloudCloudconnectionsDeleteAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudCloudconnectionsDeleteBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudCloudconnectionsDeleteUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 410: result := NewPcloudCloudconnectionsDeleteGone() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudCloudconnectionsDeleteInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -77,7 +69,7 @@ func NewPcloudCloudconnectionsDeleteOK() *PcloudCloudconnectionsDeleteOK { return &PcloudCloudconnectionsDeleteOK{} } -/*PcloudCloudconnectionsDeleteOK handles this case with default header values. +/* PcloudCloudconnectionsDeleteOK describes a response with status code 200, with default header values. OK */ @@ -88,6 +80,9 @@ type PcloudCloudconnectionsDeleteOK struct { func (o *PcloudCloudconnectionsDeleteOK) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsDeleteOK %+v", 200, o.Payload) } +func (o *PcloudCloudconnectionsDeleteOK) GetPayload() models.Object { + return o.Payload +} func (o *PcloudCloudconnectionsDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -104,7 +99,7 @@ func NewPcloudCloudconnectionsDeleteAccepted() *PcloudCloudconnectionsDeleteAcce return &PcloudCloudconnectionsDeleteAccepted{} } -/*PcloudCloudconnectionsDeleteAccepted handles this case with default header values. +/* PcloudCloudconnectionsDeleteAccepted describes a response with status code 202, with default header values. Accepted */ @@ -115,6 +110,9 @@ type PcloudCloudconnectionsDeleteAccepted struct { func (o *PcloudCloudconnectionsDeleteAccepted) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsDeleteAccepted %+v", 202, o.Payload) } +func (o *PcloudCloudconnectionsDeleteAccepted) GetPayload() *models.JobReference { + return o.Payload +} func (o *PcloudCloudconnectionsDeleteAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -133,7 +131,7 @@ func NewPcloudCloudconnectionsDeleteBadRequest() *PcloudCloudconnectionsDeleteBa return &PcloudCloudconnectionsDeleteBadRequest{} } -/*PcloudCloudconnectionsDeleteBadRequest handles this case with default header values. +/* PcloudCloudconnectionsDeleteBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -144,6 +142,9 @@ type PcloudCloudconnectionsDeleteBadRequest struct { func (o *PcloudCloudconnectionsDeleteBadRequest) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsDeleteBadRequest %+v", 400, o.Payload) } +func (o *PcloudCloudconnectionsDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -162,7 +163,7 @@ func NewPcloudCloudconnectionsDeleteUnauthorized() *PcloudCloudconnectionsDelete return &PcloudCloudconnectionsDeleteUnauthorized{} } -/*PcloudCloudconnectionsDeleteUnauthorized handles this case with default header values. +/* PcloudCloudconnectionsDeleteUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -173,6 +174,9 @@ type PcloudCloudconnectionsDeleteUnauthorized struct { func (o *PcloudCloudconnectionsDeleteUnauthorized) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsDeleteUnauthorized %+v", 401, o.Payload) } +func (o *PcloudCloudconnectionsDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -191,7 +195,7 @@ func NewPcloudCloudconnectionsDeleteGone() *PcloudCloudconnectionsDeleteGone { return &PcloudCloudconnectionsDeleteGone{} } -/*PcloudCloudconnectionsDeleteGone handles this case with default header values. +/* PcloudCloudconnectionsDeleteGone describes a response with status code 410, with default header values. Gone */ @@ -202,6 +206,9 @@ type PcloudCloudconnectionsDeleteGone struct { func (o *PcloudCloudconnectionsDeleteGone) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsDeleteGone %+v", 410, o.Payload) } +func (o *PcloudCloudconnectionsDeleteGone) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsDeleteGone) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -220,7 +227,7 @@ func NewPcloudCloudconnectionsDeleteInternalServerError() *PcloudCloudconnection return &PcloudCloudconnectionsDeleteInternalServerError{} } -/*PcloudCloudconnectionsDeleteInternalServerError handles this case with default header values. +/* PcloudCloudconnectionsDeleteInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -231,6 +238,9 @@ type PcloudCloudconnectionsDeleteInternalServerError struct { func (o *PcloudCloudconnectionsDeleteInternalServerError) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsDeleteInternalServerError %+v", 500, o.Payload) } +func (o *PcloudCloudconnectionsDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_get_parameters.go b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_get_parameters.go index 8a8f4d40..16a386f8 100644 --- a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_get_parameters.go +++ b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_get_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudCloudconnectionsGetParams creates a new PcloudCloudconnectionsGetParams object -// with the default values initialized. +// NewPcloudCloudconnectionsGetParams creates a new PcloudCloudconnectionsGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudCloudconnectionsGetParams() *PcloudCloudconnectionsGetParams { - var () return &PcloudCloudconnectionsGetParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudCloudconnectionsGetParamsWithTimeout creates a new PcloudCloudconnectionsGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudCloudconnectionsGetParamsWithTimeout(timeout time.Duration) *PcloudCloudconnectionsGetParams { - var () return &PcloudCloudconnectionsGetParams{ - timeout: timeout, } } // NewPcloudCloudconnectionsGetParamsWithContext creates a new PcloudCloudconnectionsGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudCloudconnectionsGetParamsWithContext(ctx context.Context) *PcloudCloudconnectionsGetParams { - var () return &PcloudCloudconnectionsGetParams{ - Context: ctx, } } // NewPcloudCloudconnectionsGetParamsWithHTTPClient creates a new PcloudCloudconnectionsGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudCloudconnectionsGetParamsWithHTTPClient(client *http.Client) *PcloudCloudconnectionsGetParams { - var () return &PcloudCloudconnectionsGetParams{ HTTPClient: client, } } -/*PcloudCloudconnectionsGetParams contains all the parameters to send to the API endpoint -for the pcloud cloudconnections get operation typically these are written to a http.Request +/* PcloudCloudconnectionsGetParams contains all the parameters to send to the API endpoint + for the pcloud cloudconnections get operation. + + Typically these are written to a http.Request. */ type PcloudCloudconnectionsGetParams struct { - /*CloudConnectionID - Cloud Connection ID + /* CloudConnectionID. + Cloud Connection ID */ CloudConnectionID string - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -77,6 +76,21 @@ type PcloudCloudconnectionsGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud cloudconnections get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudconnectionsGetParams) WithDefaults() *PcloudCloudconnectionsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudconnections get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudconnectionsGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud cloudconnections get params func (o *PcloudCloudconnectionsGetParams) WithTimeout(timeout time.Duration) *PcloudCloudconnectionsGetParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_get_responses.go b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_get_responses.go index 52b0f7e3..5a75e69a 100644 --- a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_get_responses.go +++ b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudCloudconnectionsGetReader is a Reader for the PcloudCloudconnectionsGet structure. @@ -24,44 +23,38 @@ type PcloudCloudconnectionsGetReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudCloudconnectionsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudCloudconnectionsGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudCloudconnectionsGetBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudCloudconnectionsGetUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudCloudconnectionsGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudCloudconnectionsGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudCloudconnectionsGetOK() *PcloudCloudconnectionsGetOK { return &PcloudCloudconnectionsGetOK{} } -/*PcloudCloudconnectionsGetOK handles this case with default header values. +/* PcloudCloudconnectionsGetOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudCloudconnectionsGetOK struct { func (o *PcloudCloudconnectionsGetOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsGetOK %+v", 200, o.Payload) } +func (o *PcloudCloudconnectionsGetOK) GetPayload() *models.CloudConnection { + return o.Payload +} func (o *PcloudCloudconnectionsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudCloudconnectionsGetBadRequest() *PcloudCloudconnectionsGetBadReque return &PcloudCloudconnectionsGetBadRequest{} } -/*PcloudCloudconnectionsGetBadRequest handles this case with default header values. +/* PcloudCloudconnectionsGetBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudCloudconnectionsGetBadRequest struct { func (o *PcloudCloudconnectionsGetBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsGetBadRequest %+v", 400, o.Payload) } +func (o *PcloudCloudconnectionsGetBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudCloudconnectionsGetUnauthorized() *PcloudCloudconnectionsGetUnauth return &PcloudCloudconnectionsGetUnauthorized{} } -/*PcloudCloudconnectionsGetUnauthorized handles this case with default header values. +/* PcloudCloudconnectionsGetUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudCloudconnectionsGetUnauthorized struct { func (o *PcloudCloudconnectionsGetUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsGetUnauthorized %+v", 401, o.Payload) } +func (o *PcloudCloudconnectionsGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudCloudconnectionsGetNotFound() *PcloudCloudconnectionsGetNotFound { return &PcloudCloudconnectionsGetNotFound{} } -/*PcloudCloudconnectionsGetNotFound handles this case with default header values. +/* PcloudCloudconnectionsGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -168,6 +170,9 @@ type PcloudCloudconnectionsGetNotFound struct { func (o *PcloudCloudconnectionsGetNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsGetNotFound %+v", 404, o.Payload) } +func (o *PcloudCloudconnectionsGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudCloudconnectionsGetInternalServerError() *PcloudCloudconnectionsGe return &PcloudCloudconnectionsGetInternalServerError{} } -/*PcloudCloudconnectionsGetInternalServerError handles this case with default header values. +/* PcloudCloudconnectionsGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudCloudconnectionsGetInternalServerError struct { func (o *PcloudCloudconnectionsGetInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsGetInternalServerError %+v", 500, o.Payload) } +func (o *PcloudCloudconnectionsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_getall_parameters.go b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_getall_parameters.go index 69487e59..ab74a7af 100644 --- a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_getall_parameters.go +++ b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_getall_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudCloudconnectionsGetallParams creates a new PcloudCloudconnectionsGetallParams object -// with the default values initialized. +// NewPcloudCloudconnectionsGetallParams creates a new PcloudCloudconnectionsGetallParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudCloudconnectionsGetallParams() *PcloudCloudconnectionsGetallParams { - var () return &PcloudCloudconnectionsGetallParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudCloudconnectionsGetallParamsWithTimeout creates a new PcloudCloudconnectionsGetallParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudCloudconnectionsGetallParamsWithTimeout(timeout time.Duration) *PcloudCloudconnectionsGetallParams { - var () return &PcloudCloudconnectionsGetallParams{ - timeout: timeout, } } // NewPcloudCloudconnectionsGetallParamsWithContext creates a new PcloudCloudconnectionsGetallParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudCloudconnectionsGetallParamsWithContext(ctx context.Context) *PcloudCloudconnectionsGetallParams { - var () return &PcloudCloudconnectionsGetallParams{ - Context: ctx, } } // NewPcloudCloudconnectionsGetallParamsWithHTTPClient creates a new PcloudCloudconnectionsGetallParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudCloudconnectionsGetallParamsWithHTTPClient(client *http.Client) *PcloudCloudconnectionsGetallParams { - var () return &PcloudCloudconnectionsGetallParams{ HTTPClient: client, } } -/*PcloudCloudconnectionsGetallParams contains all the parameters to send to the API endpoint -for the pcloud cloudconnections getall operation typically these are written to a http.Request +/* PcloudCloudconnectionsGetallParams contains all the parameters to send to the API endpoint + for the pcloud cloudconnections getall operation. + + Typically these are written to a http.Request. */ type PcloudCloudconnectionsGetallParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -72,6 +70,21 @@ type PcloudCloudconnectionsGetallParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud cloudconnections getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudconnectionsGetallParams) WithDefaults() *PcloudCloudconnectionsGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudconnections getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudconnectionsGetallParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud cloudconnections getall params func (o *PcloudCloudconnectionsGetallParams) WithTimeout(timeout time.Duration) *PcloudCloudconnectionsGetallParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_getall_responses.go b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_getall_responses.go index 262aea8f..f096d6de 100644 --- a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_getall_responses.go +++ b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_getall_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudCloudconnectionsGetallReader is a Reader for the PcloudCloudconnectionsGetall structure. @@ -24,44 +23,38 @@ type PcloudCloudconnectionsGetallReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudCloudconnectionsGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudCloudconnectionsGetallOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudCloudconnectionsGetallBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudCloudconnectionsGetallUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 408: result := NewPcloudCloudconnectionsGetallRequestTimeout() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudCloudconnectionsGetallInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudCloudconnectionsGetallOK() *PcloudCloudconnectionsGetallOK { return &PcloudCloudconnectionsGetallOK{} } -/*PcloudCloudconnectionsGetallOK handles this case with default header values. +/* PcloudCloudconnectionsGetallOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudCloudconnectionsGetallOK struct { func (o *PcloudCloudconnectionsGetallOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections][%d] pcloudCloudconnectionsGetallOK %+v", 200, o.Payload) } +func (o *PcloudCloudconnectionsGetallOK) GetPayload() *models.CloudConnections { + return o.Payload +} func (o *PcloudCloudconnectionsGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudCloudconnectionsGetallBadRequest() *PcloudCloudconnectionsGetallBa return &PcloudCloudconnectionsGetallBadRequest{} } -/*PcloudCloudconnectionsGetallBadRequest handles this case with default header values. +/* PcloudCloudconnectionsGetallBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudCloudconnectionsGetallBadRequest struct { func (o *PcloudCloudconnectionsGetallBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections][%d] pcloudCloudconnectionsGetallBadRequest %+v", 400, o.Payload) } +func (o *PcloudCloudconnectionsGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsGetallBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudCloudconnectionsGetallUnauthorized() *PcloudCloudconnectionsGetall return &PcloudCloudconnectionsGetallUnauthorized{} } -/*PcloudCloudconnectionsGetallUnauthorized handles this case with default header values. +/* PcloudCloudconnectionsGetallUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudCloudconnectionsGetallUnauthorized struct { func (o *PcloudCloudconnectionsGetallUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections][%d] pcloudCloudconnectionsGetallUnauthorized %+v", 401, o.Payload) } +func (o *PcloudCloudconnectionsGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsGetallUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudCloudconnectionsGetallRequestTimeout() *PcloudCloudconnectionsGeta return &PcloudCloudconnectionsGetallRequestTimeout{} } -/*PcloudCloudconnectionsGetallRequestTimeout handles this case with default header values. +/* PcloudCloudconnectionsGetallRequestTimeout describes a response with status code 408, with default header values. Request Timeout */ @@ -168,6 +170,9 @@ type PcloudCloudconnectionsGetallRequestTimeout struct { func (o *PcloudCloudconnectionsGetallRequestTimeout) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections][%d] pcloudCloudconnectionsGetallRequestTimeout %+v", 408, o.Payload) } +func (o *PcloudCloudconnectionsGetallRequestTimeout) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsGetallRequestTimeout) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudCloudconnectionsGetallInternalServerError() *PcloudCloudconnection return &PcloudCloudconnectionsGetallInternalServerError{} } -/*PcloudCloudconnectionsGetallInternalServerError handles this case with default header values. +/* PcloudCloudconnectionsGetallInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudCloudconnectionsGetallInternalServerError struct { func (o *PcloudCloudconnectionsGetallInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections][%d] pcloudCloudconnectionsGetallInternalServerError %+v", 500, o.Payload) } +func (o *PcloudCloudconnectionsGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsGetallInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_networks_delete_parameters.go b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_networks_delete_parameters.go index e28101d3..e3c9466d 100644 --- a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_networks_delete_parameters.go +++ b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_networks_delete_parameters.go @@ -13,67 +13,67 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudCloudconnectionsNetworksDeleteParams creates a new PcloudCloudconnectionsNetworksDeleteParams object -// with the default values initialized. +// NewPcloudCloudconnectionsNetworksDeleteParams creates a new PcloudCloudconnectionsNetworksDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudCloudconnectionsNetworksDeleteParams() *PcloudCloudconnectionsNetworksDeleteParams { - var () return &PcloudCloudconnectionsNetworksDeleteParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudCloudconnectionsNetworksDeleteParamsWithTimeout creates a new PcloudCloudconnectionsNetworksDeleteParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudCloudconnectionsNetworksDeleteParamsWithTimeout(timeout time.Duration) *PcloudCloudconnectionsNetworksDeleteParams { - var () return &PcloudCloudconnectionsNetworksDeleteParams{ - timeout: timeout, } } // NewPcloudCloudconnectionsNetworksDeleteParamsWithContext creates a new PcloudCloudconnectionsNetworksDeleteParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudCloudconnectionsNetworksDeleteParamsWithContext(ctx context.Context) *PcloudCloudconnectionsNetworksDeleteParams { - var () return &PcloudCloudconnectionsNetworksDeleteParams{ - Context: ctx, } } // NewPcloudCloudconnectionsNetworksDeleteParamsWithHTTPClient creates a new PcloudCloudconnectionsNetworksDeleteParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudCloudconnectionsNetworksDeleteParamsWithHTTPClient(client *http.Client) *PcloudCloudconnectionsNetworksDeleteParams { - var () return &PcloudCloudconnectionsNetworksDeleteParams{ HTTPClient: client, } } -/*PcloudCloudconnectionsNetworksDeleteParams contains all the parameters to send to the API endpoint -for the pcloud cloudconnections networks delete operation typically these are written to a http.Request +/* PcloudCloudconnectionsNetworksDeleteParams contains all the parameters to send to the API endpoint + for the pcloud cloudconnections networks delete operation. + + Typically these are written to a http.Request. */ type PcloudCloudconnectionsNetworksDeleteParams struct { - /*CloudConnectionID - Cloud Connection ID + /* CloudConnectionID. + Cloud Connection ID */ CloudConnectionID string - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*NetworkID - Network ID + /* NetworkID. + + Network ID */ NetworkID string @@ -82,6 +82,21 @@ type PcloudCloudconnectionsNetworksDeleteParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud cloudconnections networks delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudconnectionsNetworksDeleteParams) WithDefaults() *PcloudCloudconnectionsNetworksDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudconnections networks delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudconnectionsNetworksDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud cloudconnections networks delete params func (o *PcloudCloudconnectionsNetworksDeleteParams) WithTimeout(timeout time.Duration) *PcloudCloudconnectionsNetworksDeleteParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_networks_delete_responses.go b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_networks_delete_responses.go index 7dfc6213..02137028 100644 --- a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_networks_delete_responses.go +++ b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_networks_delete_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudCloudconnectionsNetworksDeleteReader is a Reader for the PcloudCloudconnectionsNetworksDelete structure. @@ -24,51 +23,44 @@ type PcloudCloudconnectionsNetworksDeleteReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudCloudconnectionsNetworksDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudCloudconnectionsNetworksDeleteOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 202: result := NewPcloudCloudconnectionsNetworksDeleteAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudCloudconnectionsNetworksDeleteBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudCloudconnectionsNetworksDeleteUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 410: result := NewPcloudCloudconnectionsNetworksDeleteGone() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudCloudconnectionsNetworksDeleteInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -77,7 +69,7 @@ func NewPcloudCloudconnectionsNetworksDeleteOK() *PcloudCloudconnectionsNetworks return &PcloudCloudconnectionsNetworksDeleteOK{} } -/*PcloudCloudconnectionsNetworksDeleteOK handles this case with default header values. +/* PcloudCloudconnectionsNetworksDeleteOK describes a response with status code 200, with default header values. OK */ @@ -88,6 +80,9 @@ type PcloudCloudconnectionsNetworksDeleteOK struct { func (o *PcloudCloudconnectionsNetworksDeleteOK) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}/networks/{network_id}][%d] pcloudCloudconnectionsNetworksDeleteOK %+v", 200, o.Payload) } +func (o *PcloudCloudconnectionsNetworksDeleteOK) GetPayload() *models.CloudConnection { + return o.Payload +} func (o *PcloudCloudconnectionsNetworksDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -106,7 +101,7 @@ func NewPcloudCloudconnectionsNetworksDeleteAccepted() *PcloudCloudconnectionsNe return &PcloudCloudconnectionsNetworksDeleteAccepted{} } -/*PcloudCloudconnectionsNetworksDeleteAccepted handles this case with default header values. +/* PcloudCloudconnectionsNetworksDeleteAccepted describes a response with status code 202, with default header values. Accepted */ @@ -117,6 +112,9 @@ type PcloudCloudconnectionsNetworksDeleteAccepted struct { func (o *PcloudCloudconnectionsNetworksDeleteAccepted) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}/networks/{network_id}][%d] pcloudCloudconnectionsNetworksDeleteAccepted %+v", 202, o.Payload) } +func (o *PcloudCloudconnectionsNetworksDeleteAccepted) GetPayload() *models.JobReference { + return o.Payload +} func (o *PcloudCloudconnectionsNetworksDeleteAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -135,7 +133,7 @@ func NewPcloudCloudconnectionsNetworksDeleteBadRequest() *PcloudCloudconnections return &PcloudCloudconnectionsNetworksDeleteBadRequest{} } -/*PcloudCloudconnectionsNetworksDeleteBadRequest handles this case with default header values. +/* PcloudCloudconnectionsNetworksDeleteBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -146,6 +144,9 @@ type PcloudCloudconnectionsNetworksDeleteBadRequest struct { func (o *PcloudCloudconnectionsNetworksDeleteBadRequest) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}/networks/{network_id}][%d] pcloudCloudconnectionsNetworksDeleteBadRequest %+v", 400, o.Payload) } +func (o *PcloudCloudconnectionsNetworksDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsNetworksDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -164,7 +165,7 @@ func NewPcloudCloudconnectionsNetworksDeleteUnauthorized() *PcloudCloudconnectio return &PcloudCloudconnectionsNetworksDeleteUnauthorized{} } -/*PcloudCloudconnectionsNetworksDeleteUnauthorized handles this case with default header values. +/* PcloudCloudconnectionsNetworksDeleteUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -175,6 +176,9 @@ type PcloudCloudconnectionsNetworksDeleteUnauthorized struct { func (o *PcloudCloudconnectionsNetworksDeleteUnauthorized) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}/networks/{network_id}][%d] pcloudCloudconnectionsNetworksDeleteUnauthorized %+v", 401, o.Payload) } +func (o *PcloudCloudconnectionsNetworksDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsNetworksDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -193,7 +197,7 @@ func NewPcloudCloudconnectionsNetworksDeleteGone() *PcloudCloudconnectionsNetwor return &PcloudCloudconnectionsNetworksDeleteGone{} } -/*PcloudCloudconnectionsNetworksDeleteGone handles this case with default header values. +/* PcloudCloudconnectionsNetworksDeleteGone describes a response with status code 410, with default header values. Gone */ @@ -204,6 +208,9 @@ type PcloudCloudconnectionsNetworksDeleteGone struct { func (o *PcloudCloudconnectionsNetworksDeleteGone) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}/networks/{network_id}][%d] pcloudCloudconnectionsNetworksDeleteGone %+v", 410, o.Payload) } +func (o *PcloudCloudconnectionsNetworksDeleteGone) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsNetworksDeleteGone) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -222,7 +229,7 @@ func NewPcloudCloudconnectionsNetworksDeleteInternalServerError() *PcloudCloudco return &PcloudCloudconnectionsNetworksDeleteInternalServerError{} } -/*PcloudCloudconnectionsNetworksDeleteInternalServerError handles this case with default header values. +/* PcloudCloudconnectionsNetworksDeleteInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -233,6 +240,9 @@ type PcloudCloudconnectionsNetworksDeleteInternalServerError struct { func (o *PcloudCloudconnectionsNetworksDeleteInternalServerError) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}/networks/{network_id}][%d] pcloudCloudconnectionsNetworksDeleteInternalServerError %+v", 500, o.Payload) } +func (o *PcloudCloudconnectionsNetworksDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsNetworksDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_networks_put_parameters.go b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_networks_put_parameters.go index fae9bbd5..c19e5e7a 100644 --- a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_networks_put_parameters.go +++ b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_networks_put_parameters.go @@ -13,67 +13,67 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudCloudconnectionsNetworksPutParams creates a new PcloudCloudconnectionsNetworksPutParams object -// with the default values initialized. +// NewPcloudCloudconnectionsNetworksPutParams creates a new PcloudCloudconnectionsNetworksPutParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudCloudconnectionsNetworksPutParams() *PcloudCloudconnectionsNetworksPutParams { - var () return &PcloudCloudconnectionsNetworksPutParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudCloudconnectionsNetworksPutParamsWithTimeout creates a new PcloudCloudconnectionsNetworksPutParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudCloudconnectionsNetworksPutParamsWithTimeout(timeout time.Duration) *PcloudCloudconnectionsNetworksPutParams { - var () return &PcloudCloudconnectionsNetworksPutParams{ - timeout: timeout, } } // NewPcloudCloudconnectionsNetworksPutParamsWithContext creates a new PcloudCloudconnectionsNetworksPutParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudCloudconnectionsNetworksPutParamsWithContext(ctx context.Context) *PcloudCloudconnectionsNetworksPutParams { - var () return &PcloudCloudconnectionsNetworksPutParams{ - Context: ctx, } } // NewPcloudCloudconnectionsNetworksPutParamsWithHTTPClient creates a new PcloudCloudconnectionsNetworksPutParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudCloudconnectionsNetworksPutParamsWithHTTPClient(client *http.Client) *PcloudCloudconnectionsNetworksPutParams { - var () return &PcloudCloudconnectionsNetworksPutParams{ HTTPClient: client, } } -/*PcloudCloudconnectionsNetworksPutParams contains all the parameters to send to the API endpoint -for the pcloud cloudconnections networks put operation typically these are written to a http.Request +/* PcloudCloudconnectionsNetworksPutParams contains all the parameters to send to the API endpoint + for the pcloud cloudconnections networks put operation. + + Typically these are written to a http.Request. */ type PcloudCloudconnectionsNetworksPutParams struct { - /*CloudConnectionID - Cloud Connection ID + /* CloudConnectionID. + Cloud Connection ID */ CloudConnectionID string - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*NetworkID - Network ID + /* NetworkID. + + Network ID */ NetworkID string @@ -82,6 +82,21 @@ type PcloudCloudconnectionsNetworksPutParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud cloudconnections networks put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudconnectionsNetworksPutParams) WithDefaults() *PcloudCloudconnectionsNetworksPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudconnections networks put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudconnectionsNetworksPutParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud cloudconnections networks put params func (o *PcloudCloudconnectionsNetworksPutParams) WithTimeout(timeout time.Duration) *PcloudCloudconnectionsNetworksPutParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_networks_put_responses.go b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_networks_put_responses.go index d90ce0a3..e4abe1cc 100644 --- a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_networks_put_responses.go +++ b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_networks_put_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudCloudconnectionsNetworksPutReader is a Reader for the PcloudCloudconnectionsNetworksPut structure. @@ -24,51 +23,44 @@ type PcloudCloudconnectionsNetworksPutReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudCloudconnectionsNetworksPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudCloudconnectionsNetworksPutOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 202: result := NewPcloudCloudconnectionsNetworksPutAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudCloudconnectionsNetworksPutBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudCloudconnectionsNetworksPutUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudCloudconnectionsNetworksPutUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudCloudconnectionsNetworksPutInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -77,7 +69,7 @@ func NewPcloudCloudconnectionsNetworksPutOK() *PcloudCloudconnectionsNetworksPut return &PcloudCloudconnectionsNetworksPutOK{} } -/*PcloudCloudconnectionsNetworksPutOK handles this case with default header values. +/* PcloudCloudconnectionsNetworksPutOK describes a response with status code 200, with default header values. OK */ @@ -88,6 +80,9 @@ type PcloudCloudconnectionsNetworksPutOK struct { func (o *PcloudCloudconnectionsNetworksPutOK) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}/networks/{network_id}][%d] pcloudCloudconnectionsNetworksPutOK %+v", 200, o.Payload) } +func (o *PcloudCloudconnectionsNetworksPutOK) GetPayload() *models.CloudConnection { + return o.Payload +} func (o *PcloudCloudconnectionsNetworksPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -106,7 +101,7 @@ func NewPcloudCloudconnectionsNetworksPutAccepted() *PcloudCloudconnectionsNetwo return &PcloudCloudconnectionsNetworksPutAccepted{} } -/*PcloudCloudconnectionsNetworksPutAccepted handles this case with default header values. +/* PcloudCloudconnectionsNetworksPutAccepted describes a response with status code 202, with default header values. Accepted */ @@ -117,6 +112,9 @@ type PcloudCloudconnectionsNetworksPutAccepted struct { func (o *PcloudCloudconnectionsNetworksPutAccepted) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}/networks/{network_id}][%d] pcloudCloudconnectionsNetworksPutAccepted %+v", 202, o.Payload) } +func (o *PcloudCloudconnectionsNetworksPutAccepted) GetPayload() *models.JobReference { + return o.Payload +} func (o *PcloudCloudconnectionsNetworksPutAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -135,7 +133,7 @@ func NewPcloudCloudconnectionsNetworksPutBadRequest() *PcloudCloudconnectionsNet return &PcloudCloudconnectionsNetworksPutBadRequest{} } -/*PcloudCloudconnectionsNetworksPutBadRequest handles this case with default header values. +/* PcloudCloudconnectionsNetworksPutBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -146,6 +144,9 @@ type PcloudCloudconnectionsNetworksPutBadRequest struct { func (o *PcloudCloudconnectionsNetworksPutBadRequest) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}/networks/{network_id}][%d] pcloudCloudconnectionsNetworksPutBadRequest %+v", 400, o.Payload) } +func (o *PcloudCloudconnectionsNetworksPutBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsNetworksPutBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -164,7 +165,7 @@ func NewPcloudCloudconnectionsNetworksPutUnauthorized() *PcloudCloudconnectionsN return &PcloudCloudconnectionsNetworksPutUnauthorized{} } -/*PcloudCloudconnectionsNetworksPutUnauthorized handles this case with default header values. +/* PcloudCloudconnectionsNetworksPutUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -175,6 +176,9 @@ type PcloudCloudconnectionsNetworksPutUnauthorized struct { func (o *PcloudCloudconnectionsNetworksPutUnauthorized) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}/networks/{network_id}][%d] pcloudCloudconnectionsNetworksPutUnauthorized %+v", 401, o.Payload) } +func (o *PcloudCloudconnectionsNetworksPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsNetworksPutUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -193,7 +197,7 @@ func NewPcloudCloudconnectionsNetworksPutUnprocessableEntity() *PcloudCloudconne return &PcloudCloudconnectionsNetworksPutUnprocessableEntity{} } -/*PcloudCloudconnectionsNetworksPutUnprocessableEntity handles this case with default header values. +/* PcloudCloudconnectionsNetworksPutUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -204,6 +208,9 @@ type PcloudCloudconnectionsNetworksPutUnprocessableEntity struct { func (o *PcloudCloudconnectionsNetworksPutUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}/networks/{network_id}][%d] pcloudCloudconnectionsNetworksPutUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudCloudconnectionsNetworksPutUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsNetworksPutUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -222,7 +229,7 @@ func NewPcloudCloudconnectionsNetworksPutInternalServerError() *PcloudCloudconne return &PcloudCloudconnectionsNetworksPutInternalServerError{} } -/*PcloudCloudconnectionsNetworksPutInternalServerError handles this case with default header values. +/* PcloudCloudconnectionsNetworksPutInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -233,6 +240,9 @@ type PcloudCloudconnectionsNetworksPutInternalServerError struct { func (o *PcloudCloudconnectionsNetworksPutInternalServerError) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}/networks/{network_id}][%d] pcloudCloudconnectionsNetworksPutInternalServerError %+v", 500, o.Payload) } +func (o *PcloudCloudconnectionsNetworksPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsNetworksPutInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_post_parameters.go b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_post_parameters.go index 7e0d595d..71ee602f 100644 --- a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_post_parameters.go +++ b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_post_parameters.go @@ -13,64 +13,63 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudCloudconnectionsPostParams creates a new PcloudCloudconnectionsPostParams object -// with the default values initialized. +// NewPcloudCloudconnectionsPostParams creates a new PcloudCloudconnectionsPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudCloudconnectionsPostParams() *PcloudCloudconnectionsPostParams { - var () return &PcloudCloudconnectionsPostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudCloudconnectionsPostParamsWithTimeout creates a new PcloudCloudconnectionsPostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudCloudconnectionsPostParamsWithTimeout(timeout time.Duration) *PcloudCloudconnectionsPostParams { - var () return &PcloudCloudconnectionsPostParams{ - timeout: timeout, } } // NewPcloudCloudconnectionsPostParamsWithContext creates a new PcloudCloudconnectionsPostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudCloudconnectionsPostParamsWithContext(ctx context.Context) *PcloudCloudconnectionsPostParams { - var () return &PcloudCloudconnectionsPostParams{ - Context: ctx, } } // NewPcloudCloudconnectionsPostParamsWithHTTPClient creates a new PcloudCloudconnectionsPostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudCloudconnectionsPostParamsWithHTTPClient(client *http.Client) *PcloudCloudconnectionsPostParams { - var () return &PcloudCloudconnectionsPostParams{ HTTPClient: client, } } -/*PcloudCloudconnectionsPostParams contains all the parameters to send to the API endpoint -for the pcloud cloudconnections post operation typically these are written to a http.Request +/* PcloudCloudconnectionsPostParams contains all the parameters to send to the API endpoint + for the pcloud cloudconnections post operation. + + Typically these are written to a http.Request. */ type PcloudCloudconnectionsPostParams struct { - /*Body - Parameters for the creation of a new cloud connection + /* Body. + Parameters for the creation of a new cloud connection */ Body *models.CloudConnectionCreate - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -79,6 +78,21 @@ type PcloudCloudconnectionsPostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud cloudconnections post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudconnectionsPostParams) WithDefaults() *PcloudCloudconnectionsPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudconnections post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudconnectionsPostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud cloudconnections post params func (o *PcloudCloudconnectionsPostParams) WithTimeout(timeout time.Duration) *PcloudCloudconnectionsPostParams { o.SetTimeout(timeout) @@ -141,7 +155,6 @@ func (o *PcloudCloudconnectionsPostParams) WriteToRequest(r runtime.ClientReques return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_post_responses.go b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_post_responses.go index 209112b0..b0f46e4e 100644 --- a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_post_responses.go +++ b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudCloudconnectionsPostReader is a Reader for the PcloudCloudconnectionsPost structure. @@ -24,65 +23,56 @@ type PcloudCloudconnectionsPostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudCloudconnectionsPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudCloudconnectionsPostOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 201: result := NewPcloudCloudconnectionsPostCreated() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 202: result := NewPcloudCloudconnectionsPostAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudCloudconnectionsPostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudCloudconnectionsPostUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 409: result := NewPcloudCloudconnectionsPostConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudCloudconnectionsPostUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudCloudconnectionsPostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -91,7 +81,7 @@ func NewPcloudCloudconnectionsPostOK() *PcloudCloudconnectionsPostOK { return &PcloudCloudconnectionsPostOK{} } -/*PcloudCloudconnectionsPostOK handles this case with default header values. +/* PcloudCloudconnectionsPostOK describes a response with status code 200, with default header values. OK */ @@ -102,6 +92,9 @@ type PcloudCloudconnectionsPostOK struct { func (o *PcloudCloudconnectionsPostOK) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections][%d] pcloudCloudconnectionsPostOK %+v", 200, o.Payload) } +func (o *PcloudCloudconnectionsPostOK) GetPayload() *models.CloudConnection { + return o.Payload +} func (o *PcloudCloudconnectionsPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -120,7 +113,7 @@ func NewPcloudCloudconnectionsPostCreated() *PcloudCloudconnectionsPostCreated { return &PcloudCloudconnectionsPostCreated{} } -/*PcloudCloudconnectionsPostCreated handles this case with default header values. +/* PcloudCloudconnectionsPostCreated describes a response with status code 201, with default header values. Created */ @@ -131,6 +124,9 @@ type PcloudCloudconnectionsPostCreated struct { func (o *PcloudCloudconnectionsPostCreated) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections][%d] pcloudCloudconnectionsPostCreated %+v", 201, o.Payload) } +func (o *PcloudCloudconnectionsPostCreated) GetPayload() *models.CloudConnection { + return o.Payload +} func (o *PcloudCloudconnectionsPostCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -149,7 +145,7 @@ func NewPcloudCloudconnectionsPostAccepted() *PcloudCloudconnectionsPostAccepted return &PcloudCloudconnectionsPostAccepted{} } -/*PcloudCloudconnectionsPostAccepted handles this case with default header values. +/* PcloudCloudconnectionsPostAccepted describes a response with status code 202, with default header values. Accepted */ @@ -160,6 +156,9 @@ type PcloudCloudconnectionsPostAccepted struct { func (o *PcloudCloudconnectionsPostAccepted) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections][%d] pcloudCloudconnectionsPostAccepted %+v", 202, o.Payload) } +func (o *PcloudCloudconnectionsPostAccepted) GetPayload() *models.CloudConnectionCreateResponse { + return o.Payload +} func (o *PcloudCloudconnectionsPostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -178,7 +177,7 @@ func NewPcloudCloudconnectionsPostBadRequest() *PcloudCloudconnectionsPostBadReq return &PcloudCloudconnectionsPostBadRequest{} } -/*PcloudCloudconnectionsPostBadRequest handles this case with default header values. +/* PcloudCloudconnectionsPostBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -189,6 +188,9 @@ type PcloudCloudconnectionsPostBadRequest struct { func (o *PcloudCloudconnectionsPostBadRequest) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections][%d] pcloudCloudconnectionsPostBadRequest %+v", 400, o.Payload) } +func (o *PcloudCloudconnectionsPostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -207,7 +209,7 @@ func NewPcloudCloudconnectionsPostUnauthorized() *PcloudCloudconnectionsPostUnau return &PcloudCloudconnectionsPostUnauthorized{} } -/*PcloudCloudconnectionsPostUnauthorized handles this case with default header values. +/* PcloudCloudconnectionsPostUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -218,6 +220,9 @@ type PcloudCloudconnectionsPostUnauthorized struct { func (o *PcloudCloudconnectionsPostUnauthorized) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections][%d] pcloudCloudconnectionsPostUnauthorized %+v", 401, o.Payload) } +func (o *PcloudCloudconnectionsPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -236,7 +241,7 @@ func NewPcloudCloudconnectionsPostConflict() *PcloudCloudconnectionsPostConflict return &PcloudCloudconnectionsPostConflict{} } -/*PcloudCloudconnectionsPostConflict handles this case with default header values. +/* PcloudCloudconnectionsPostConflict describes a response with status code 409, with default header values. Conflict */ @@ -247,6 +252,9 @@ type PcloudCloudconnectionsPostConflict struct { func (o *PcloudCloudconnectionsPostConflict) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections][%d] pcloudCloudconnectionsPostConflict %+v", 409, o.Payload) } +func (o *PcloudCloudconnectionsPostConflict) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsPostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -265,7 +273,7 @@ func NewPcloudCloudconnectionsPostUnprocessableEntity() *PcloudCloudconnectionsP return &PcloudCloudconnectionsPostUnprocessableEntity{} } -/*PcloudCloudconnectionsPostUnprocessableEntity handles this case with default header values. +/* PcloudCloudconnectionsPostUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -276,6 +284,9 @@ type PcloudCloudconnectionsPostUnprocessableEntity struct { func (o *PcloudCloudconnectionsPostUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections][%d] pcloudCloudconnectionsPostUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudCloudconnectionsPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsPostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -294,7 +305,7 @@ func NewPcloudCloudconnectionsPostInternalServerError() *PcloudCloudconnectionsP return &PcloudCloudconnectionsPostInternalServerError{} } -/*PcloudCloudconnectionsPostInternalServerError handles this case with default header values. +/* PcloudCloudconnectionsPostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -305,6 +316,9 @@ type PcloudCloudconnectionsPostInternalServerError struct { func (o *PcloudCloudconnectionsPostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections][%d] pcloudCloudconnectionsPostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudCloudconnectionsPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_put_parameters.go b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_put_parameters.go index 902efdd5..13698088 100644 --- a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_put_parameters.go +++ b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_put_parameters.go @@ -13,69 +13,69 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudCloudconnectionsPutParams creates a new PcloudCloudconnectionsPutParams object -// with the default values initialized. +// NewPcloudCloudconnectionsPutParams creates a new PcloudCloudconnectionsPutParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudCloudconnectionsPutParams() *PcloudCloudconnectionsPutParams { - var () return &PcloudCloudconnectionsPutParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudCloudconnectionsPutParamsWithTimeout creates a new PcloudCloudconnectionsPutParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudCloudconnectionsPutParamsWithTimeout(timeout time.Duration) *PcloudCloudconnectionsPutParams { - var () return &PcloudCloudconnectionsPutParams{ - timeout: timeout, } } // NewPcloudCloudconnectionsPutParamsWithContext creates a new PcloudCloudconnectionsPutParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudCloudconnectionsPutParamsWithContext(ctx context.Context) *PcloudCloudconnectionsPutParams { - var () return &PcloudCloudconnectionsPutParams{ - Context: ctx, } } // NewPcloudCloudconnectionsPutParamsWithHTTPClient creates a new PcloudCloudconnectionsPutParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudCloudconnectionsPutParamsWithHTTPClient(client *http.Client) *PcloudCloudconnectionsPutParams { - var () return &PcloudCloudconnectionsPutParams{ HTTPClient: client, } } -/*PcloudCloudconnectionsPutParams contains all the parameters to send to the API endpoint -for the pcloud cloudconnections put operation typically these are written to a http.Request +/* PcloudCloudconnectionsPutParams contains all the parameters to send to the API endpoint + for the pcloud cloudconnections put operation. + + Typically these are written to a http.Request. */ type PcloudCloudconnectionsPutParams struct { - /*Body - Parameters to update a Cloud Connection + /* Body. + Parameters to update a Cloud Connection */ Body *models.CloudConnectionUpdate - /*CloudConnectionID - Cloud Connection ID + /* CloudConnectionID. + + Cloud Connection ID */ CloudConnectionID string - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -84,6 +84,21 @@ type PcloudCloudconnectionsPutParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud cloudconnections put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudconnectionsPutParams) WithDefaults() *PcloudCloudconnectionsPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudconnections put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudconnectionsPutParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud cloudconnections put params func (o *PcloudCloudconnectionsPutParams) WithTimeout(timeout time.Duration) *PcloudCloudconnectionsPutParams { o.SetTimeout(timeout) @@ -157,7 +172,6 @@ func (o *PcloudCloudconnectionsPutParams) WriteToRequest(r runtime.ClientRequest return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_put_responses.go b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_put_responses.go index eb9837c0..1eaec8d5 100644 --- a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_put_responses.go +++ b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_put_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudCloudconnectionsPutReader is a Reader for the PcloudCloudconnectionsPut structure. @@ -24,72 +23,62 @@ type PcloudCloudconnectionsPutReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudCloudconnectionsPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudCloudconnectionsPutOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 202: result := NewPcloudCloudconnectionsPutAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudCloudconnectionsPutBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudCloudconnectionsPutUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudCloudconnectionsPutNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 405: result := NewPcloudCloudconnectionsPutMethodNotAllowed() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 409: result := NewPcloudCloudconnectionsPutConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudCloudconnectionsPutUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudCloudconnectionsPutInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -98,7 +87,7 @@ func NewPcloudCloudconnectionsPutOK() *PcloudCloudconnectionsPutOK { return &PcloudCloudconnectionsPutOK{} } -/*PcloudCloudconnectionsPutOK handles this case with default header values. +/* PcloudCloudconnectionsPutOK describes a response with status code 200, with default header values. OK */ @@ -109,6 +98,9 @@ type PcloudCloudconnectionsPutOK struct { func (o *PcloudCloudconnectionsPutOK) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsPutOK %+v", 200, o.Payload) } +func (o *PcloudCloudconnectionsPutOK) GetPayload() *models.CloudConnection { + return o.Payload +} func (o *PcloudCloudconnectionsPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -127,7 +119,7 @@ func NewPcloudCloudconnectionsPutAccepted() *PcloudCloudconnectionsPutAccepted { return &PcloudCloudconnectionsPutAccepted{} } -/*PcloudCloudconnectionsPutAccepted handles this case with default header values. +/* PcloudCloudconnectionsPutAccepted describes a response with status code 202, with default header values. Accepted */ @@ -138,6 +130,9 @@ type PcloudCloudconnectionsPutAccepted struct { func (o *PcloudCloudconnectionsPutAccepted) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsPutAccepted %+v", 202, o.Payload) } +func (o *PcloudCloudconnectionsPutAccepted) GetPayload() *models.JobReference { + return o.Payload +} func (o *PcloudCloudconnectionsPutAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -156,7 +151,7 @@ func NewPcloudCloudconnectionsPutBadRequest() *PcloudCloudconnectionsPutBadReque return &PcloudCloudconnectionsPutBadRequest{} } -/*PcloudCloudconnectionsPutBadRequest handles this case with default header values. +/* PcloudCloudconnectionsPutBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -167,6 +162,9 @@ type PcloudCloudconnectionsPutBadRequest struct { func (o *PcloudCloudconnectionsPutBadRequest) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsPutBadRequest %+v", 400, o.Payload) } +func (o *PcloudCloudconnectionsPutBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsPutBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -185,7 +183,7 @@ func NewPcloudCloudconnectionsPutUnauthorized() *PcloudCloudconnectionsPutUnauth return &PcloudCloudconnectionsPutUnauthorized{} } -/*PcloudCloudconnectionsPutUnauthorized handles this case with default header values. +/* PcloudCloudconnectionsPutUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -196,6 +194,9 @@ type PcloudCloudconnectionsPutUnauthorized struct { func (o *PcloudCloudconnectionsPutUnauthorized) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsPutUnauthorized %+v", 401, o.Payload) } +func (o *PcloudCloudconnectionsPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsPutUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -214,7 +215,7 @@ func NewPcloudCloudconnectionsPutNotFound() *PcloudCloudconnectionsPutNotFound { return &PcloudCloudconnectionsPutNotFound{} } -/*PcloudCloudconnectionsPutNotFound handles this case with default header values. +/* PcloudCloudconnectionsPutNotFound describes a response with status code 404, with default header values. Not Found */ @@ -225,6 +226,9 @@ type PcloudCloudconnectionsPutNotFound struct { func (o *PcloudCloudconnectionsPutNotFound) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsPutNotFound %+v", 404, o.Payload) } +func (o *PcloudCloudconnectionsPutNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsPutNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -243,7 +247,7 @@ func NewPcloudCloudconnectionsPutMethodNotAllowed() *PcloudCloudconnectionsPutMe return &PcloudCloudconnectionsPutMethodNotAllowed{} } -/*PcloudCloudconnectionsPutMethodNotAllowed handles this case with default header values. +/* PcloudCloudconnectionsPutMethodNotAllowed describes a response with status code 405, with default header values. Method Not Allowed */ @@ -254,6 +258,9 @@ type PcloudCloudconnectionsPutMethodNotAllowed struct { func (o *PcloudCloudconnectionsPutMethodNotAllowed) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsPutMethodNotAllowed %+v", 405, o.Payload) } +func (o *PcloudCloudconnectionsPutMethodNotAllowed) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsPutMethodNotAllowed) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -272,7 +279,7 @@ func NewPcloudCloudconnectionsPutConflict() *PcloudCloudconnectionsPutConflict { return &PcloudCloudconnectionsPutConflict{} } -/*PcloudCloudconnectionsPutConflict handles this case with default header values. +/* PcloudCloudconnectionsPutConflict describes a response with status code 409, with default header values. Conflict */ @@ -283,6 +290,9 @@ type PcloudCloudconnectionsPutConflict struct { func (o *PcloudCloudconnectionsPutConflict) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsPutConflict %+v", 409, o.Payload) } +func (o *PcloudCloudconnectionsPutConflict) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsPutConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -301,7 +311,7 @@ func NewPcloudCloudconnectionsPutUnprocessableEntity() *PcloudCloudconnectionsPu return &PcloudCloudconnectionsPutUnprocessableEntity{} } -/*PcloudCloudconnectionsPutUnprocessableEntity handles this case with default header values. +/* PcloudCloudconnectionsPutUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -312,6 +322,9 @@ type PcloudCloudconnectionsPutUnprocessableEntity struct { func (o *PcloudCloudconnectionsPutUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsPutUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudCloudconnectionsPutUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsPutUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -330,7 +343,7 @@ func NewPcloudCloudconnectionsPutInternalServerError() *PcloudCloudconnectionsPu return &PcloudCloudconnectionsPutInternalServerError{} } -/*PcloudCloudconnectionsPutInternalServerError handles this case with default header values. +/* PcloudCloudconnectionsPutInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -341,6 +354,9 @@ type PcloudCloudconnectionsPutInternalServerError struct { func (o *PcloudCloudconnectionsPutInternalServerError) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsPutInternalServerError %+v", 500, o.Payload) } +func (o *PcloudCloudconnectionsPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsPutInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_virtualprivateclouds_getall_parameters.go b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_virtualprivateclouds_getall_parameters.go index 540fd666..6cc7c04c 100644 --- a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_virtualprivateclouds_getall_parameters.go +++ b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_virtualprivateclouds_getall_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudCloudconnectionsVirtualprivatecloudsGetallParams creates a new PcloudCloudconnectionsVirtualprivatecloudsGetallParams object -// with the default values initialized. +// NewPcloudCloudconnectionsVirtualprivatecloudsGetallParams creates a new PcloudCloudconnectionsVirtualprivatecloudsGetallParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudCloudconnectionsVirtualprivatecloudsGetallParams() *PcloudCloudconnectionsVirtualprivatecloudsGetallParams { - var () return &PcloudCloudconnectionsVirtualprivatecloudsGetallParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudCloudconnectionsVirtualprivatecloudsGetallParamsWithTimeout creates a new PcloudCloudconnectionsVirtualprivatecloudsGetallParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudCloudconnectionsVirtualprivatecloudsGetallParamsWithTimeout(timeout time.Duration) *PcloudCloudconnectionsVirtualprivatecloudsGetallParams { - var () return &PcloudCloudconnectionsVirtualprivatecloudsGetallParams{ - timeout: timeout, } } // NewPcloudCloudconnectionsVirtualprivatecloudsGetallParamsWithContext creates a new PcloudCloudconnectionsVirtualprivatecloudsGetallParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudCloudconnectionsVirtualprivatecloudsGetallParamsWithContext(ctx context.Context) *PcloudCloudconnectionsVirtualprivatecloudsGetallParams { - var () return &PcloudCloudconnectionsVirtualprivatecloudsGetallParams{ - Context: ctx, } } // NewPcloudCloudconnectionsVirtualprivatecloudsGetallParamsWithHTTPClient creates a new PcloudCloudconnectionsVirtualprivatecloudsGetallParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudCloudconnectionsVirtualprivatecloudsGetallParamsWithHTTPClient(client *http.Client) *PcloudCloudconnectionsVirtualprivatecloudsGetallParams { - var () return &PcloudCloudconnectionsVirtualprivatecloudsGetallParams{ HTTPClient: client, } } -/*PcloudCloudconnectionsVirtualprivatecloudsGetallParams contains all the parameters to send to the API endpoint -for the pcloud cloudconnections virtualprivateclouds getall operation typically these are written to a http.Request +/* PcloudCloudconnectionsVirtualprivatecloudsGetallParams contains all the parameters to send to the API endpoint + for the pcloud cloudconnections virtualprivateclouds getall operation. + + Typically these are written to a http.Request. */ type PcloudCloudconnectionsVirtualprivatecloudsGetallParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -72,6 +70,21 @@ type PcloudCloudconnectionsVirtualprivatecloudsGetallParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud cloudconnections virtualprivateclouds getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallParams) WithDefaults() *PcloudCloudconnectionsVirtualprivatecloudsGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudconnections virtualprivateclouds getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud cloudconnections virtualprivateclouds getall params func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallParams) WithTimeout(timeout time.Duration) *PcloudCloudconnectionsVirtualprivatecloudsGetallParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_virtualprivateclouds_getall_responses.go b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_virtualprivateclouds_getall_responses.go index 971f611f..ad162ef3 100644 --- a/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_virtualprivateclouds_getall_responses.go +++ b/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_virtualprivateclouds_getall_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudCloudconnectionsVirtualprivatecloudsGetallReader is a Reader for the PcloudCloudconnectionsVirtualprivatecloudsGetall structure. @@ -24,37 +23,32 @@ type PcloudCloudconnectionsVirtualprivatecloudsGetallReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudCloudconnectionsVirtualprivatecloudsGetallOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudCloudconnectionsVirtualprivatecloudsGetallBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudCloudconnectionsVirtualprivatecloudsGetallUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudCloudconnectionsVirtualprivatecloudsGetallInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -63,7 +57,7 @@ func NewPcloudCloudconnectionsVirtualprivatecloudsGetallOK() *PcloudCloudconnect return &PcloudCloudconnectionsVirtualprivatecloudsGetallOK{} } -/*PcloudCloudconnectionsVirtualprivatecloudsGetallOK handles this case with default header values. +/* PcloudCloudconnectionsVirtualprivatecloudsGetallOK describes a response with status code 200, with default header values. OK */ @@ -74,6 +68,9 @@ type PcloudCloudconnectionsVirtualprivatecloudsGetallOK struct { func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections-virtual-private-clouds][%d] pcloudCloudconnectionsVirtualprivatecloudsGetallOK %+v", 200, o.Payload) } +func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallOK) GetPayload() *models.CloudConnectionVirtualPrivateClouds { + return o.Payload +} func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -92,7 +89,7 @@ func NewPcloudCloudconnectionsVirtualprivatecloudsGetallBadRequest() *PcloudClou return &PcloudCloudconnectionsVirtualprivatecloudsGetallBadRequest{} } -/*PcloudCloudconnectionsVirtualprivatecloudsGetallBadRequest handles this case with default header values. +/* PcloudCloudconnectionsVirtualprivatecloudsGetallBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -103,6 +100,9 @@ type PcloudCloudconnectionsVirtualprivatecloudsGetallBadRequest struct { func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections-virtual-private-clouds][%d] pcloudCloudconnectionsVirtualprivatecloudsGetallBadRequest %+v", 400, o.Payload) } +func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -121,7 +121,7 @@ func NewPcloudCloudconnectionsVirtualprivatecloudsGetallUnauthorized() *PcloudCl return &PcloudCloudconnectionsVirtualprivatecloudsGetallUnauthorized{} } -/*PcloudCloudconnectionsVirtualprivatecloudsGetallUnauthorized handles this case with default header values. +/* PcloudCloudconnectionsVirtualprivatecloudsGetallUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -132,6 +132,9 @@ type PcloudCloudconnectionsVirtualprivatecloudsGetallUnauthorized struct { func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections-virtual-private-clouds][%d] pcloudCloudconnectionsVirtualprivatecloudsGetallUnauthorized %+v", 401, o.Payload) } +func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -150,7 +153,7 @@ func NewPcloudCloudconnectionsVirtualprivatecloudsGetallInternalServerError() *P return &PcloudCloudconnectionsVirtualprivatecloudsGetallInternalServerError{} } -/*PcloudCloudconnectionsVirtualprivatecloudsGetallInternalServerError handles this case with default header values. +/* PcloudCloudconnectionsVirtualprivatecloudsGetallInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -161,6 +164,9 @@ type PcloudCloudconnectionsVirtualprivatecloudsGetallInternalServerError struct func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections-virtual-private-clouds][%d] pcloudCloudconnectionsVirtualprivatecloudsGetallInternalServerError %+v", 500, o.Payload) } +func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_events/p_cloud_events_client.go b/power/client/p_cloud_events/p_cloud_events_client.go index 41cd2f13..7305a156 100644 --- a/power/client/p_cloud_events/p_cloud_events_client.go +++ b/power/client/p_cloud_events/p_cloud_events_client.go @@ -6,13 +6,14 @@ package p_cloud_events // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/runtime" + "fmt" - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" ) // New creates a new p cloud events API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { return &Client{transport: transport, formats: formats} } @@ -24,16 +25,27 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudEventsGet(params *PcloudEventsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudEventsGetOK, error) + + PcloudEventsGetquery(params *PcloudEventsGetqueryParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudEventsGetqueryOK, error) + + SetTransport(transport runtime.ClientTransport) +} + /* -PcloudEventsGet gets a single event + PcloudEventsGet gets a single event */ -func (a *Client) PcloudEventsGet(params *PcloudEventsGetParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudEventsGetOK, error) { +func (a *Client) PcloudEventsGet(params *PcloudEventsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudEventsGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudEventsGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.events.get", Method: "GET", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/events/{event_id}", @@ -45,24 +57,34 @@ func (a *Client) PcloudEventsGet(params *PcloudEventsGetParams, authInfo runtime AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudEventsGetOK), nil - + success, ok := result.(*PcloudEventsGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.events.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudEventsGetquery gets events from this cloud instance since a specific timestamp + PcloudEventsGetquery gets events from this cloud instance since a specific timestamp */ -func (a *Client) PcloudEventsGetquery(params *PcloudEventsGetqueryParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudEventsGetqueryOK, error) { +func (a *Client) PcloudEventsGetquery(params *PcloudEventsGetqueryParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudEventsGetqueryOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudEventsGetqueryParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.events.getquery", Method: "GET", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/events", @@ -74,12 +96,23 @@ func (a *Client) PcloudEventsGetquery(params *PcloudEventsGetqueryParams, authIn AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudEventsGetqueryOK), nil - + success, ok := result.(*PcloudEventsGetqueryOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.events.getquery: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } // SetTransport changes the transport on the client diff --git a/power/client/p_cloud_events/pcloud_events_get_parameters.go b/power/client/p_cloud_events/pcloud_events_get_parameters.go index 459c4f0e..a2b5d98e 100644 --- a/power/client/p_cloud_events/pcloud_events_get_parameters.go +++ b/power/client/p_cloud_events/pcloud_events_get_parameters.go @@ -13,67 +13,67 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudEventsGetParams creates a new PcloudEventsGetParams object -// with the default values initialized. +// NewPcloudEventsGetParams creates a new PcloudEventsGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudEventsGetParams() *PcloudEventsGetParams { - var () return &PcloudEventsGetParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudEventsGetParamsWithTimeout creates a new PcloudEventsGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudEventsGetParamsWithTimeout(timeout time.Duration) *PcloudEventsGetParams { - var () return &PcloudEventsGetParams{ - timeout: timeout, } } // NewPcloudEventsGetParamsWithContext creates a new PcloudEventsGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudEventsGetParamsWithContext(ctx context.Context) *PcloudEventsGetParams { - var () return &PcloudEventsGetParams{ - Context: ctx, } } // NewPcloudEventsGetParamsWithHTTPClient creates a new PcloudEventsGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudEventsGetParamsWithHTTPClient(client *http.Client) *PcloudEventsGetParams { - var () return &PcloudEventsGetParams{ HTTPClient: client, } } -/*PcloudEventsGetParams contains all the parameters to send to the API endpoint -for the pcloud events get operation typically these are written to a http.Request +/* PcloudEventsGetParams contains all the parameters to send to the API endpoint + for the pcloud events get operation. + + Typically these are written to a http.Request. */ type PcloudEventsGetParams struct { - /*AcceptLanguage - The language requested for the return document + /* AcceptLanguage. + The language requested for the return document */ AcceptLanguage *string - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*EventID - Event ID + /* EventID. + + Event ID */ EventID string @@ -82,6 +82,21 @@ type PcloudEventsGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud events get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudEventsGetParams) WithDefaults() *PcloudEventsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud events get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudEventsGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud events get params func (o *PcloudEventsGetParams) WithTimeout(timeout time.Duration) *PcloudEventsGetParams { o.SetTimeout(timeout) @@ -162,7 +177,6 @@ func (o *PcloudEventsGetParams) WriteToRequest(r runtime.ClientRequest, reg strf if err := r.SetHeaderParam("Accept-Language", *o.AcceptLanguage); err != nil { return err } - } // path param cloud_instance_id diff --git a/power/client/p_cloud_events/pcloud_events_get_responses.go b/power/client/p_cloud_events/pcloud_events_get_responses.go index 0285dc7a..ff28ed26 100644 --- a/power/client/p_cloud_events/pcloud_events_get_responses.go +++ b/power/client/p_cloud_events/pcloud_events_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudEventsGetReader is a Reader for the PcloudEventsGet structure. @@ -24,44 +23,38 @@ type PcloudEventsGetReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudEventsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudEventsGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudEventsGetBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudEventsGetUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudEventsGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudEventsGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudEventsGetOK() *PcloudEventsGetOK { return &PcloudEventsGetOK{} } -/*PcloudEventsGetOK handles this case with default header values. +/* PcloudEventsGetOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudEventsGetOK struct { func (o *PcloudEventsGetOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/events/{event_id}][%d] pcloudEventsGetOK %+v", 200, o.Payload) } +func (o *PcloudEventsGetOK) GetPayload() *models.Event { + return o.Payload +} func (o *PcloudEventsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudEventsGetBadRequest() *PcloudEventsGetBadRequest { return &PcloudEventsGetBadRequest{} } -/*PcloudEventsGetBadRequest handles this case with default header values. +/* PcloudEventsGetBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudEventsGetBadRequest struct { func (o *PcloudEventsGetBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/events/{event_id}][%d] pcloudEventsGetBadRequest %+v", 400, o.Payload) } +func (o *PcloudEventsGetBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudEventsGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudEventsGetUnauthorized() *PcloudEventsGetUnauthorized { return &PcloudEventsGetUnauthorized{} } -/*PcloudEventsGetUnauthorized handles this case with default header values. +/* PcloudEventsGetUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudEventsGetUnauthorized struct { func (o *PcloudEventsGetUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/events/{event_id}][%d] pcloudEventsGetUnauthorized %+v", 401, o.Payload) } +func (o *PcloudEventsGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudEventsGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudEventsGetNotFound() *PcloudEventsGetNotFound { return &PcloudEventsGetNotFound{} } -/*PcloudEventsGetNotFound handles this case with default header values. +/* PcloudEventsGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -168,6 +170,9 @@ type PcloudEventsGetNotFound struct { func (o *PcloudEventsGetNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/events/{event_id}][%d] pcloudEventsGetNotFound %+v", 404, o.Payload) } +func (o *PcloudEventsGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudEventsGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudEventsGetInternalServerError() *PcloudEventsGetInternalServerError return &PcloudEventsGetInternalServerError{} } -/*PcloudEventsGetInternalServerError handles this case with default header values. +/* PcloudEventsGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudEventsGetInternalServerError struct { func (o *PcloudEventsGetInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/events/{event_id}][%d] pcloudEventsGetInternalServerError %+v", 500, o.Payload) } +func (o *PcloudEventsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudEventsGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_events/pcloud_events_getquery_parameters.go b/power/client/p_cloud_events/pcloud_events_getquery_parameters.go index 83d27dcf..4ee037fa 100644 --- a/power/client/p_cloud_events/pcloud_events_getquery_parameters.go +++ b/power/client/p_cloud_events/pcloud_events_getquery_parameters.go @@ -13,77 +13,79 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudEventsGetqueryParams creates a new PcloudEventsGetqueryParams object -// with the default values initialized. +// NewPcloudEventsGetqueryParams creates a new PcloudEventsGetqueryParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudEventsGetqueryParams() *PcloudEventsGetqueryParams { - var () return &PcloudEventsGetqueryParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudEventsGetqueryParamsWithTimeout creates a new PcloudEventsGetqueryParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudEventsGetqueryParamsWithTimeout(timeout time.Duration) *PcloudEventsGetqueryParams { - var () return &PcloudEventsGetqueryParams{ - timeout: timeout, } } // NewPcloudEventsGetqueryParamsWithContext creates a new PcloudEventsGetqueryParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudEventsGetqueryParamsWithContext(ctx context.Context) *PcloudEventsGetqueryParams { - var () return &PcloudEventsGetqueryParams{ - Context: ctx, } } // NewPcloudEventsGetqueryParamsWithHTTPClient creates a new PcloudEventsGetqueryParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudEventsGetqueryParamsWithHTTPClient(client *http.Client) *PcloudEventsGetqueryParams { - var () return &PcloudEventsGetqueryParams{ HTTPClient: client, } } -/*PcloudEventsGetqueryParams contains all the parameters to send to the API endpoint -for the pcloud events getquery operation typically these are written to a http.Request +/* PcloudEventsGetqueryParams contains all the parameters to send to the API endpoint + for the pcloud events getquery operation. + + Typically these are written to a http.Request. */ type PcloudEventsGetqueryParams struct { - /*AcceptLanguage - The language requested for the return document + /* AcceptLanguage. + The language requested for the return document */ AcceptLanguage *string - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*FromTime - A from query time in either ISO 8601 or unix epoch format + /* FromTime. + + A from query time in either ISO 8601 or unix epoch format */ FromTime *string - /*Time - (deprecated - use from_time) A time in either ISO 8601 or unix epoch format + /* Time. + + (deprecated - use from_time) A time in either ISO 8601 or unix epoch format */ Time *string - /*ToTime - A to query time in either ISO 8601 or unix epoch format + /* ToTime. + + A to query time in either ISO 8601 or unix epoch format */ ToTime *string @@ -92,6 +94,21 @@ type PcloudEventsGetqueryParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud events getquery params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudEventsGetqueryParams) WithDefaults() *PcloudEventsGetqueryParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud events getquery params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudEventsGetqueryParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud events getquery params func (o *PcloudEventsGetqueryParams) WithTimeout(timeout time.Duration) *PcloudEventsGetqueryParams { o.SetTimeout(timeout) @@ -194,7 +211,6 @@ func (o *PcloudEventsGetqueryParams) WriteToRequest(r runtime.ClientRequest, reg if err := r.SetHeaderParam("Accept-Language", *o.AcceptLanguage); err != nil { return err } - } // path param cloud_instance_id @@ -206,48 +222,51 @@ func (o *PcloudEventsGetqueryParams) WriteToRequest(r runtime.ClientRequest, reg // query param from_time var qrFromTime string + if o.FromTime != nil { qrFromTime = *o.FromTime } qFromTime := qrFromTime if qFromTime != "" { + if err := r.SetQueryParam("from_time", qFromTime); err != nil { return err } } - } if o.Time != nil { // query param time var qrTime string + if o.Time != nil { qrTime = *o.Time } qTime := qrTime if qTime != "" { + if err := r.SetQueryParam("time", qTime); err != nil { return err } } - } if o.ToTime != nil { // query param to_time var qrToTime string + if o.ToTime != nil { qrToTime = *o.ToTime } qToTime := qrToTime if qToTime != "" { + if err := r.SetQueryParam("to_time", qToTime); err != nil { return err } } - } if len(res) > 0 { diff --git a/power/client/p_cloud_events/pcloud_events_getquery_responses.go b/power/client/p_cloud_events/pcloud_events_getquery_responses.go index f6087864..b018f267 100644 --- a/power/client/p_cloud_events/pcloud_events_getquery_responses.go +++ b/power/client/p_cloud_events/pcloud_events_getquery_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudEventsGetqueryReader is a Reader for the PcloudEventsGetquery structure. @@ -24,37 +23,32 @@ type PcloudEventsGetqueryReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudEventsGetqueryReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudEventsGetqueryOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudEventsGetqueryBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudEventsGetqueryUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudEventsGetqueryInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -63,7 +57,7 @@ func NewPcloudEventsGetqueryOK() *PcloudEventsGetqueryOK { return &PcloudEventsGetqueryOK{} } -/*PcloudEventsGetqueryOK handles this case with default header values. +/* PcloudEventsGetqueryOK describes a response with status code 200, with default header values. OK */ @@ -74,6 +68,9 @@ type PcloudEventsGetqueryOK struct { func (o *PcloudEventsGetqueryOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/events][%d] pcloudEventsGetqueryOK %+v", 200, o.Payload) } +func (o *PcloudEventsGetqueryOK) GetPayload() *models.Events { + return o.Payload +} func (o *PcloudEventsGetqueryOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -92,7 +89,7 @@ func NewPcloudEventsGetqueryBadRequest() *PcloudEventsGetqueryBadRequest { return &PcloudEventsGetqueryBadRequest{} } -/*PcloudEventsGetqueryBadRequest handles this case with default header values. +/* PcloudEventsGetqueryBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -103,6 +100,9 @@ type PcloudEventsGetqueryBadRequest struct { func (o *PcloudEventsGetqueryBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/events][%d] pcloudEventsGetqueryBadRequest %+v", 400, o.Payload) } +func (o *PcloudEventsGetqueryBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudEventsGetqueryBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -121,7 +121,7 @@ func NewPcloudEventsGetqueryUnauthorized() *PcloudEventsGetqueryUnauthorized { return &PcloudEventsGetqueryUnauthorized{} } -/*PcloudEventsGetqueryUnauthorized handles this case with default header values. +/* PcloudEventsGetqueryUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -132,6 +132,9 @@ type PcloudEventsGetqueryUnauthorized struct { func (o *PcloudEventsGetqueryUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/events][%d] pcloudEventsGetqueryUnauthorized %+v", 401, o.Payload) } +func (o *PcloudEventsGetqueryUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudEventsGetqueryUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -150,7 +153,7 @@ func NewPcloudEventsGetqueryInternalServerError() *PcloudEventsGetqueryInternalS return &PcloudEventsGetqueryInternalServerError{} } -/*PcloudEventsGetqueryInternalServerError handles this case with default header values. +/* PcloudEventsGetqueryInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -161,6 +164,9 @@ type PcloudEventsGetqueryInternalServerError struct { func (o *PcloudEventsGetqueryInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/events][%d] pcloudEventsGetqueryInternalServerError %+v", 500, o.Payload) } +func (o *PcloudEventsGetqueryInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudEventsGetqueryInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_images/p_cloud_images_client.go b/power/client/p_cloud_images/p_cloud_images_client.go index 25cccf7a..be0badf8 100644 --- a/power/client/p_cloud_images/p_cloud_images_client.go +++ b/power/client/p_cloud_images/p_cloud_images_client.go @@ -6,13 +6,14 @@ package p_cloud_images // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/runtime" + "fmt" - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" ) // New creates a new p cloud images API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { return &Client{transport: transport, formats: formats} } @@ -24,16 +25,49 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudCloudinstancesImagesDelete(params *PcloudCloudinstancesImagesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesImagesDeleteOK, error) + + PcloudCloudinstancesImagesExportPost(params *PcloudCloudinstancesImagesExportPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesImagesExportPostAccepted, error) + + PcloudCloudinstancesImagesGet(params *PcloudCloudinstancesImagesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesImagesGetOK, error) + + PcloudCloudinstancesImagesGetall(params *PcloudCloudinstancesImagesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesImagesGetallOK, error) + + PcloudCloudinstancesImagesPost(params *PcloudCloudinstancesImagesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesImagesPostOK, *PcloudCloudinstancesImagesPostCreated, error) + + PcloudCloudinstancesStockimagesGet(params *PcloudCloudinstancesStockimagesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesStockimagesGetOK, error) + + PcloudCloudinstancesStockimagesGetall(params *PcloudCloudinstancesStockimagesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesStockimagesGetallOK, error) + + PcloudImagesGet(params *PcloudImagesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudImagesGetOK, error) + + PcloudImagesGetall(params *PcloudImagesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudImagesGetallOK, error) + + PcloudV1CloudinstancesCosimagesGet(params *PcloudV1CloudinstancesCosimagesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV1CloudinstancesCosimagesGetOK, error) + + PcloudV1CloudinstancesCosimagesPost(params *PcloudV1CloudinstancesCosimagesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV1CloudinstancesCosimagesPostAccepted, error) + + PcloudV2ImagesExportGet(params *PcloudV2ImagesExportGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2ImagesExportGetOK, error) + + PcloudV2ImagesExportPost(params *PcloudV2ImagesExportPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2ImagesExportPostAccepted, error) + + SetTransport(transport runtime.ClientTransport) +} + /* -PcloudCloudinstancesImagesDelete deletes an image from a cloud instance + PcloudCloudinstancesImagesDelete deletes an image from a cloud instance */ -func (a *Client) PcloudCloudinstancesImagesDelete(params *PcloudCloudinstancesImagesDeleteParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudCloudinstancesImagesDeleteOK, error) { +func (a *Client) PcloudCloudinstancesImagesDelete(params *PcloudCloudinstancesImagesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesImagesDeleteOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudCloudinstancesImagesDeleteParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.cloudinstances.images.delete", Method: "DELETE", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}", @@ -45,24 +79,34 @@ func (a *Client) PcloudCloudinstancesImagesDelete(params *PcloudCloudinstancesIm AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudCloudinstancesImagesDeleteOK), nil - + success, ok := result.(*PcloudCloudinstancesImagesDeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.cloudinstances.images.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudCloudinstancesImagesExportPost exports an image + PcloudCloudinstancesImagesExportPost exports an image */ -func (a *Client) PcloudCloudinstancesImagesExportPost(params *PcloudCloudinstancesImagesExportPostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudCloudinstancesImagesExportPostAccepted, error) { +func (a *Client) PcloudCloudinstancesImagesExportPost(params *PcloudCloudinstancesImagesExportPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesImagesExportPostAccepted, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudCloudinstancesImagesExportPostParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.cloudinstances.images.export.post", Method: "POST", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}/export", @@ -74,24 +118,34 @@ func (a *Client) PcloudCloudinstancesImagesExportPost(params *PcloudCloudinstanc AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudCloudinstancesImagesExportPostAccepted), nil - + success, ok := result.(*PcloudCloudinstancesImagesExportPostAccepted) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.cloudinstances.images.export.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudCloudinstancesImagesGet detaileds info of an image + PcloudCloudinstancesImagesGet detaileds info of an image */ -func (a *Client) PcloudCloudinstancesImagesGet(params *PcloudCloudinstancesImagesGetParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudCloudinstancesImagesGetOK, error) { +func (a *Client) PcloudCloudinstancesImagesGet(params *PcloudCloudinstancesImagesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesImagesGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudCloudinstancesImagesGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.cloudinstances.images.get", Method: "GET", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}", @@ -103,24 +157,34 @@ func (a *Client) PcloudCloudinstancesImagesGet(params *PcloudCloudinstancesImage AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudCloudinstancesImagesGetOK), nil - + success, ok := result.(*PcloudCloudinstancesImagesGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.cloudinstances.images.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudCloudinstancesImagesGetall lists all images for this cloud instance + PcloudCloudinstancesImagesGetall lists all images for this cloud instance */ -func (a *Client) PcloudCloudinstancesImagesGetall(params *PcloudCloudinstancesImagesGetallParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudCloudinstancesImagesGetallOK, error) { +func (a *Client) PcloudCloudinstancesImagesGetall(params *PcloudCloudinstancesImagesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesImagesGetallOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudCloudinstancesImagesGetallParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.cloudinstances.images.getall", Method: "GET", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/images", @@ -132,24 +196,34 @@ func (a *Client) PcloudCloudinstancesImagesGetall(params *PcloudCloudinstancesIm AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudCloudinstancesImagesGetallOK), nil - + success, ok := result.(*PcloudCloudinstancesImagesGetallOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.cloudinstances.images.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudCloudinstancesImagesPost creates a new image from available images + PcloudCloudinstancesImagesPost creates a new image from available images */ -func (a *Client) PcloudCloudinstancesImagesPost(params *PcloudCloudinstancesImagesPostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudCloudinstancesImagesPostOK, *PcloudCloudinstancesImagesPostCreated, error) { +func (a *Client) PcloudCloudinstancesImagesPost(params *PcloudCloudinstancesImagesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesImagesPostOK, *PcloudCloudinstancesImagesPostCreated, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudCloudinstancesImagesPostParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.cloudinstances.images.post", Method: "POST", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/images", @@ -161,7 +235,12 @@ func (a *Client) PcloudCloudinstancesImagesPost(params *PcloudCloudinstancesImag AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, nil, err } @@ -171,20 +250,20 @@ func (a *Client) PcloudCloudinstancesImagesPost(params *PcloudCloudinstancesImag case *PcloudCloudinstancesImagesPostCreated: return nil, value, nil } - return nil, nil, nil - + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for p_cloud_images: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudCloudinstancesStockimagesGet detaileds info of an available stock image + PcloudCloudinstancesStockimagesGet detaileds info of an available stock image */ -func (a *Client) PcloudCloudinstancesStockimagesGet(params *PcloudCloudinstancesStockimagesGetParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudCloudinstancesStockimagesGetOK, error) { +func (a *Client) PcloudCloudinstancesStockimagesGet(params *PcloudCloudinstancesStockimagesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesStockimagesGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudCloudinstancesStockimagesGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.cloudinstances.stockimages.get", Method: "GET", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/stock-images/{image_id}", @@ -196,24 +275,34 @@ func (a *Client) PcloudCloudinstancesStockimagesGet(params *PcloudCloudinstances AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudCloudinstancesStockimagesGetOK), nil - + success, ok := result.(*PcloudCloudinstancesStockimagesGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.cloudinstances.stockimages.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudCloudinstancesStockimagesGetall lists all available stock images + PcloudCloudinstancesStockimagesGetall lists all available stock images */ -func (a *Client) PcloudCloudinstancesStockimagesGetall(params *PcloudCloudinstancesStockimagesGetallParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudCloudinstancesStockimagesGetallOK, error) { +func (a *Client) PcloudCloudinstancesStockimagesGetall(params *PcloudCloudinstancesStockimagesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesStockimagesGetallOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudCloudinstancesStockimagesGetallParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.cloudinstances.stockimages.getall", Method: "GET", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/stock-images", @@ -225,24 +314,34 @@ func (a *Client) PcloudCloudinstancesStockimagesGetall(params *PcloudCloudinstan AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudCloudinstancesStockimagesGetallOK), nil - + success, ok := result.(*PcloudCloudinstancesStockimagesGetallOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.cloudinstances.stockimages.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudImagesGet deprecateds for pcloud v1 cloud instances cloud instance id stock images image id detailed info of an available stock image + PcloudImagesGet deprecateds for pcloud v1 cloud instances cloud instance id stock images image id detailed info of an available stock image */ -func (a *Client) PcloudImagesGet(params *PcloudImagesGetParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudImagesGetOK, error) { +func (a *Client) PcloudImagesGet(params *PcloudImagesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudImagesGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudImagesGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.images.get", Method: "GET", PathPattern: "/pcloud/v1/images/{image_id}", @@ -254,24 +353,34 @@ func (a *Client) PcloudImagesGet(params *PcloudImagesGetParams, authInfo runtime AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudImagesGetOK), nil - + success, ok := result.(*PcloudImagesGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.images.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudImagesGetall deprecateds for pcloud v1 cloud instances cloud instance id stock images list all available stock images + PcloudImagesGetall deprecateds for pcloud v1 cloud instances cloud instance id stock images list all available stock images */ -func (a *Client) PcloudImagesGetall(params *PcloudImagesGetallParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudImagesGetallOK, error) { +func (a *Client) PcloudImagesGetall(params *PcloudImagesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudImagesGetallOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudImagesGetallParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.images.getall", Method: "GET", PathPattern: "/pcloud/v1/images", @@ -283,24 +392,34 @@ func (a *Client) PcloudImagesGetall(params *PcloudImagesGetallParams, authInfo r AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudImagesGetallOK), nil - + success, ok := result.(*PcloudImagesGetallOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.images.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudV1CloudinstancesCosimagesGet gets detail of last cos image import job + PcloudV1CloudinstancesCosimagesGet gets detail of last cos image import job */ -func (a *Client) PcloudV1CloudinstancesCosimagesGet(params *PcloudV1CloudinstancesCosimagesGetParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudV1CloudinstancesCosimagesGetOK, error) { +func (a *Client) PcloudV1CloudinstancesCosimagesGet(params *PcloudV1CloudinstancesCosimagesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV1CloudinstancesCosimagesGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudV1CloudinstancesCosimagesGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.v1.cloudinstances.cosimages.get", Method: "GET", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/cos-images", @@ -312,24 +431,34 @@ func (a *Client) PcloudV1CloudinstancesCosimagesGet(params *PcloudV1Cloudinstanc AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudV1CloudinstancesCosimagesGetOK), nil - + success, ok := result.(*PcloudV1CloudinstancesCosimagesGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.v1.cloudinstances.cosimages.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudV1CloudinstancesCosimagesPost creates an cos image import job + PcloudV1CloudinstancesCosimagesPost creates an cos image import job */ -func (a *Client) PcloudV1CloudinstancesCosimagesPost(params *PcloudV1CloudinstancesCosimagesPostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudV1CloudinstancesCosimagesPostAccepted, error) { +func (a *Client) PcloudV1CloudinstancesCosimagesPost(params *PcloudV1CloudinstancesCosimagesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV1CloudinstancesCosimagesPostAccepted, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudV1CloudinstancesCosimagesPostParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.v1.cloudinstances.cosimages.post", Method: "POST", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/cos-images", @@ -341,24 +470,34 @@ func (a *Client) PcloudV1CloudinstancesCosimagesPost(params *PcloudV1Cloudinstan AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudV1CloudinstancesCosimagesPostAccepted), nil - + success, ok := result.(*PcloudV1CloudinstancesCosimagesPostAccepted) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.v1.cloudinstances.cosimages.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudV2ImagesExportGet gets detail of last image export job + PcloudV2ImagesExportGet gets detail of last image export job */ -func (a *Client) PcloudV2ImagesExportGet(params *PcloudV2ImagesExportGetParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudV2ImagesExportGetOK, error) { +func (a *Client) PcloudV2ImagesExportGet(params *PcloudV2ImagesExportGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2ImagesExportGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudV2ImagesExportGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.v2.images.export.get", Method: "GET", PathPattern: "/pcloud/v2/cloud-instances/{cloud_instance_id}/images/{image_id}/export", @@ -370,24 +509,34 @@ func (a *Client) PcloudV2ImagesExportGet(params *PcloudV2ImagesExportGetParams, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudV2ImagesExportGetOK), nil - + success, ok := result.(*PcloudV2ImagesExportGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.v2.images.export.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudV2ImagesExportPost adds image export job to the jobs queue + PcloudV2ImagesExportPost adds image export job to the jobs queue */ -func (a *Client) PcloudV2ImagesExportPost(params *PcloudV2ImagesExportPostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudV2ImagesExportPostAccepted, error) { +func (a *Client) PcloudV2ImagesExportPost(params *PcloudV2ImagesExportPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2ImagesExportPostAccepted, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudV2ImagesExportPostParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.v2.images.export.post", Method: "POST", PathPattern: "/pcloud/v2/cloud-instances/{cloud_instance_id}/images/{image_id}/export", @@ -399,12 +548,23 @@ func (a *Client) PcloudV2ImagesExportPost(params *PcloudV2ImagesExportPostParams AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudV2ImagesExportPostAccepted), nil - + success, ok := result.(*PcloudV2ImagesExportPostAccepted) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.v2.images.export.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } // SetTransport changes the transport on the client diff --git a/power/client/p_cloud_images/pcloud_cloudinstances_images_delete_parameters.go b/power/client/p_cloud_images/pcloud_cloudinstances_images_delete_parameters.go index aa70c053..36c1a384 100644 --- a/power/client/p_cloud_images/pcloud_cloudinstances_images_delete_parameters.go +++ b/power/client/p_cloud_images/pcloud_cloudinstances_images_delete_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudCloudinstancesImagesDeleteParams creates a new PcloudCloudinstancesImagesDeleteParams object -// with the default values initialized. +// NewPcloudCloudinstancesImagesDeleteParams creates a new PcloudCloudinstancesImagesDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudCloudinstancesImagesDeleteParams() *PcloudCloudinstancesImagesDeleteParams { - var () return &PcloudCloudinstancesImagesDeleteParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudCloudinstancesImagesDeleteParamsWithTimeout creates a new PcloudCloudinstancesImagesDeleteParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudCloudinstancesImagesDeleteParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesImagesDeleteParams { - var () return &PcloudCloudinstancesImagesDeleteParams{ - timeout: timeout, } } // NewPcloudCloudinstancesImagesDeleteParamsWithContext creates a new PcloudCloudinstancesImagesDeleteParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudCloudinstancesImagesDeleteParamsWithContext(ctx context.Context) *PcloudCloudinstancesImagesDeleteParams { - var () return &PcloudCloudinstancesImagesDeleteParams{ - Context: ctx, } } // NewPcloudCloudinstancesImagesDeleteParamsWithHTTPClient creates a new PcloudCloudinstancesImagesDeleteParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudCloudinstancesImagesDeleteParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesImagesDeleteParams { - var () return &PcloudCloudinstancesImagesDeleteParams{ HTTPClient: client, } } -/*PcloudCloudinstancesImagesDeleteParams contains all the parameters to send to the API endpoint -for the pcloud cloudinstances images delete operation typically these are written to a http.Request +/* PcloudCloudinstancesImagesDeleteParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances images delete operation. + + Typically these are written to a http.Request. */ type PcloudCloudinstancesImagesDeleteParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*ImageID - Image ID of a image + /* ImageID. + + Image ID of a image */ ImageID string @@ -77,6 +76,21 @@ type PcloudCloudinstancesImagesDeleteParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud cloudinstances images delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesImagesDeleteParams) WithDefaults() *PcloudCloudinstancesImagesDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances images delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesImagesDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud cloudinstances images delete params func (o *PcloudCloudinstancesImagesDeleteParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesImagesDeleteParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_images/pcloud_cloudinstances_images_delete_responses.go b/power/client/p_cloud_images/pcloud_cloudinstances_images_delete_responses.go index 180ec118..27719800 100644 --- a/power/client/p_cloud_images/pcloud_cloudinstances_images_delete_responses.go +++ b/power/client/p_cloud_images/pcloud_cloudinstances_images_delete_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudCloudinstancesImagesDeleteReader is a Reader for the PcloudCloudinstancesImagesDelete structure. @@ -24,44 +23,38 @@ type PcloudCloudinstancesImagesDeleteReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudCloudinstancesImagesDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudCloudinstancesImagesDeleteOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudCloudinstancesImagesDeleteBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudCloudinstancesImagesDeleteUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 410: result := NewPcloudCloudinstancesImagesDeleteGone() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudCloudinstancesImagesDeleteInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudCloudinstancesImagesDeleteOK() *PcloudCloudinstancesImagesDeleteOK return &PcloudCloudinstancesImagesDeleteOK{} } -/*PcloudCloudinstancesImagesDeleteOK handles this case with default header values. +/* PcloudCloudinstancesImagesDeleteOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudCloudinstancesImagesDeleteOK struct { func (o *PcloudCloudinstancesImagesDeleteOK) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}][%d] pcloudCloudinstancesImagesDeleteOK %+v", 200, o.Payload) } +func (o *PcloudCloudinstancesImagesDeleteOK) GetPayload() models.Object { + return o.Payload +} func (o *PcloudCloudinstancesImagesDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -97,7 +93,7 @@ func NewPcloudCloudinstancesImagesDeleteBadRequest() *PcloudCloudinstancesImages return &PcloudCloudinstancesImagesDeleteBadRequest{} } -/*PcloudCloudinstancesImagesDeleteBadRequest handles this case with default header values. +/* PcloudCloudinstancesImagesDeleteBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -108,6 +104,9 @@ type PcloudCloudinstancesImagesDeleteBadRequest struct { func (o *PcloudCloudinstancesImagesDeleteBadRequest) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}][%d] pcloudCloudinstancesImagesDeleteBadRequest %+v", 400, o.Payload) } +func (o *PcloudCloudinstancesImagesDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesImagesDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -126,7 +125,7 @@ func NewPcloudCloudinstancesImagesDeleteUnauthorized() *PcloudCloudinstancesImag return &PcloudCloudinstancesImagesDeleteUnauthorized{} } -/*PcloudCloudinstancesImagesDeleteUnauthorized handles this case with default header values. +/* PcloudCloudinstancesImagesDeleteUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -137,6 +136,9 @@ type PcloudCloudinstancesImagesDeleteUnauthorized struct { func (o *PcloudCloudinstancesImagesDeleteUnauthorized) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}][%d] pcloudCloudinstancesImagesDeleteUnauthorized %+v", 401, o.Payload) } +func (o *PcloudCloudinstancesImagesDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesImagesDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -155,7 +157,7 @@ func NewPcloudCloudinstancesImagesDeleteGone() *PcloudCloudinstancesImagesDelete return &PcloudCloudinstancesImagesDeleteGone{} } -/*PcloudCloudinstancesImagesDeleteGone handles this case with default header values. +/* PcloudCloudinstancesImagesDeleteGone describes a response with status code 410, with default header values. Gone */ @@ -166,6 +168,9 @@ type PcloudCloudinstancesImagesDeleteGone struct { func (o *PcloudCloudinstancesImagesDeleteGone) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}][%d] pcloudCloudinstancesImagesDeleteGone %+v", 410, o.Payload) } +func (o *PcloudCloudinstancesImagesDeleteGone) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesImagesDeleteGone) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -184,7 +189,7 @@ func NewPcloudCloudinstancesImagesDeleteInternalServerError() *PcloudCloudinstan return &PcloudCloudinstancesImagesDeleteInternalServerError{} } -/*PcloudCloudinstancesImagesDeleteInternalServerError handles this case with default header values. +/* PcloudCloudinstancesImagesDeleteInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -195,6 +200,9 @@ type PcloudCloudinstancesImagesDeleteInternalServerError struct { func (o *PcloudCloudinstancesImagesDeleteInternalServerError) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}][%d] pcloudCloudinstancesImagesDeleteInternalServerError %+v", 500, o.Payload) } +func (o *PcloudCloudinstancesImagesDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesImagesDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_images/pcloud_cloudinstances_images_export_post_parameters.go b/power/client/p_cloud_images/pcloud_cloudinstances_images_export_post_parameters.go index afc5ec09..ec3a6247 100644 --- a/power/client/p_cloud_images/pcloud_cloudinstances_images_export_post_parameters.go +++ b/power/client/p_cloud_images/pcloud_cloudinstances_images_export_post_parameters.go @@ -13,69 +13,69 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudCloudinstancesImagesExportPostParams creates a new PcloudCloudinstancesImagesExportPostParams object -// with the default values initialized. +// NewPcloudCloudinstancesImagesExportPostParams creates a new PcloudCloudinstancesImagesExportPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudCloudinstancesImagesExportPostParams() *PcloudCloudinstancesImagesExportPostParams { - var () return &PcloudCloudinstancesImagesExportPostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudCloudinstancesImagesExportPostParamsWithTimeout creates a new PcloudCloudinstancesImagesExportPostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudCloudinstancesImagesExportPostParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesImagesExportPostParams { - var () return &PcloudCloudinstancesImagesExportPostParams{ - timeout: timeout, } } // NewPcloudCloudinstancesImagesExportPostParamsWithContext creates a new PcloudCloudinstancesImagesExportPostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudCloudinstancesImagesExportPostParamsWithContext(ctx context.Context) *PcloudCloudinstancesImagesExportPostParams { - var () return &PcloudCloudinstancesImagesExportPostParams{ - Context: ctx, } } // NewPcloudCloudinstancesImagesExportPostParamsWithHTTPClient creates a new PcloudCloudinstancesImagesExportPostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudCloudinstancesImagesExportPostParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesImagesExportPostParams { - var () return &PcloudCloudinstancesImagesExportPostParams{ HTTPClient: client, } } -/*PcloudCloudinstancesImagesExportPostParams contains all the parameters to send to the API endpoint -for the pcloud cloudinstances images export post operation typically these are written to a http.Request +/* PcloudCloudinstancesImagesExportPostParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances images export post operation. + + Typically these are written to a http.Request. */ type PcloudCloudinstancesImagesExportPostParams struct { - /*Body - Parameters for exporting an image + /* Body. + Parameters for exporting an image */ Body *models.ExportImage - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*ImageID - Image ID of a image + /* ImageID. + + Image ID of a image */ ImageID string @@ -84,6 +84,21 @@ type PcloudCloudinstancesImagesExportPostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud cloudinstances images export post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesImagesExportPostParams) WithDefaults() *PcloudCloudinstancesImagesExportPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances images export post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesImagesExportPostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud cloudinstances images export post params func (o *PcloudCloudinstancesImagesExportPostParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesImagesExportPostParams { o.SetTimeout(timeout) @@ -157,7 +172,6 @@ func (o *PcloudCloudinstancesImagesExportPostParams) WriteToRequest(r runtime.Cl return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_images/pcloud_cloudinstances_images_export_post_responses.go b/power/client/p_cloud_images/pcloud_cloudinstances_images_export_post_responses.go index 1c341c28..0b0a6a0b 100644 --- a/power/client/p_cloud_images/pcloud_cloudinstances_images_export_post_responses.go +++ b/power/client/p_cloud_images/pcloud_cloudinstances_images_export_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudCloudinstancesImagesExportPostReader is a Reader for the PcloudCloudinstancesImagesExportPost structure. @@ -24,51 +23,44 @@ type PcloudCloudinstancesImagesExportPostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudCloudinstancesImagesExportPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 202: result := NewPcloudCloudinstancesImagesExportPostAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudCloudinstancesImagesExportPostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudCloudinstancesImagesExportPostUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudCloudinstancesImagesExportPostNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudCloudinstancesImagesExportPostUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudCloudinstancesImagesExportPostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -77,7 +69,7 @@ func NewPcloudCloudinstancesImagesExportPostAccepted() *PcloudCloudinstancesImag return &PcloudCloudinstancesImagesExportPostAccepted{} } -/*PcloudCloudinstancesImagesExportPostAccepted handles this case with default header values. +/* PcloudCloudinstancesImagesExportPostAccepted describes a response with status code 202, with default header values. Accepted */ @@ -88,6 +80,9 @@ type PcloudCloudinstancesImagesExportPostAccepted struct { func (o *PcloudCloudinstancesImagesExportPostAccepted) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}/export][%d] pcloudCloudinstancesImagesExportPostAccepted %+v", 202, o.Payload) } +func (o *PcloudCloudinstancesImagesExportPostAccepted) GetPayload() models.Object { + return o.Payload +} func (o *PcloudCloudinstancesImagesExportPostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -104,7 +99,7 @@ func NewPcloudCloudinstancesImagesExportPostBadRequest() *PcloudCloudinstancesIm return &PcloudCloudinstancesImagesExportPostBadRequest{} } -/*PcloudCloudinstancesImagesExportPostBadRequest handles this case with default header values. +/* PcloudCloudinstancesImagesExportPostBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -115,6 +110,9 @@ type PcloudCloudinstancesImagesExportPostBadRequest struct { func (o *PcloudCloudinstancesImagesExportPostBadRequest) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}/export][%d] pcloudCloudinstancesImagesExportPostBadRequest %+v", 400, o.Payload) } +func (o *PcloudCloudinstancesImagesExportPostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesImagesExportPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -133,7 +131,7 @@ func NewPcloudCloudinstancesImagesExportPostUnauthorized() *PcloudCloudinstances return &PcloudCloudinstancesImagesExportPostUnauthorized{} } -/*PcloudCloudinstancesImagesExportPostUnauthorized handles this case with default header values. +/* PcloudCloudinstancesImagesExportPostUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -144,6 +142,9 @@ type PcloudCloudinstancesImagesExportPostUnauthorized struct { func (o *PcloudCloudinstancesImagesExportPostUnauthorized) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}/export][%d] pcloudCloudinstancesImagesExportPostUnauthorized %+v", 401, o.Payload) } +func (o *PcloudCloudinstancesImagesExportPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesImagesExportPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -162,7 +163,7 @@ func NewPcloudCloudinstancesImagesExportPostNotFound() *PcloudCloudinstancesImag return &PcloudCloudinstancesImagesExportPostNotFound{} } -/*PcloudCloudinstancesImagesExportPostNotFound handles this case with default header values. +/* PcloudCloudinstancesImagesExportPostNotFound describes a response with status code 404, with default header values. Not Found */ @@ -173,6 +174,9 @@ type PcloudCloudinstancesImagesExportPostNotFound struct { func (o *PcloudCloudinstancesImagesExportPostNotFound) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}/export][%d] pcloudCloudinstancesImagesExportPostNotFound %+v", 404, o.Payload) } +func (o *PcloudCloudinstancesImagesExportPostNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesImagesExportPostNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -191,7 +195,7 @@ func NewPcloudCloudinstancesImagesExportPostUnprocessableEntity() *PcloudCloudin return &PcloudCloudinstancesImagesExportPostUnprocessableEntity{} } -/*PcloudCloudinstancesImagesExportPostUnprocessableEntity handles this case with default header values. +/* PcloudCloudinstancesImagesExportPostUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -202,6 +206,9 @@ type PcloudCloudinstancesImagesExportPostUnprocessableEntity struct { func (o *PcloudCloudinstancesImagesExportPostUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}/export][%d] pcloudCloudinstancesImagesExportPostUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudCloudinstancesImagesExportPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesImagesExportPostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -220,7 +227,7 @@ func NewPcloudCloudinstancesImagesExportPostInternalServerError() *PcloudCloudin return &PcloudCloudinstancesImagesExportPostInternalServerError{} } -/*PcloudCloudinstancesImagesExportPostInternalServerError handles this case with default header values. +/* PcloudCloudinstancesImagesExportPostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -231,6 +238,9 @@ type PcloudCloudinstancesImagesExportPostInternalServerError struct { func (o *PcloudCloudinstancesImagesExportPostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}/export][%d] pcloudCloudinstancesImagesExportPostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudCloudinstancesImagesExportPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesImagesExportPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_images/pcloud_cloudinstances_images_get_parameters.go b/power/client/p_cloud_images/pcloud_cloudinstances_images_get_parameters.go index 9f5ba65e..decd92c0 100644 --- a/power/client/p_cloud_images/pcloud_cloudinstances_images_get_parameters.go +++ b/power/client/p_cloud_images/pcloud_cloudinstances_images_get_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudCloudinstancesImagesGetParams creates a new PcloudCloudinstancesImagesGetParams object -// with the default values initialized. +// NewPcloudCloudinstancesImagesGetParams creates a new PcloudCloudinstancesImagesGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudCloudinstancesImagesGetParams() *PcloudCloudinstancesImagesGetParams { - var () return &PcloudCloudinstancesImagesGetParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudCloudinstancesImagesGetParamsWithTimeout creates a new PcloudCloudinstancesImagesGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudCloudinstancesImagesGetParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesImagesGetParams { - var () return &PcloudCloudinstancesImagesGetParams{ - timeout: timeout, } } // NewPcloudCloudinstancesImagesGetParamsWithContext creates a new PcloudCloudinstancesImagesGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudCloudinstancesImagesGetParamsWithContext(ctx context.Context) *PcloudCloudinstancesImagesGetParams { - var () return &PcloudCloudinstancesImagesGetParams{ - Context: ctx, } } // NewPcloudCloudinstancesImagesGetParamsWithHTTPClient creates a new PcloudCloudinstancesImagesGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudCloudinstancesImagesGetParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesImagesGetParams { - var () return &PcloudCloudinstancesImagesGetParams{ HTTPClient: client, } } -/*PcloudCloudinstancesImagesGetParams contains all the parameters to send to the API endpoint -for the pcloud cloudinstances images get operation typically these are written to a http.Request +/* PcloudCloudinstancesImagesGetParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances images get operation. + + Typically these are written to a http.Request. */ type PcloudCloudinstancesImagesGetParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*ImageID - Image ID of a image + /* ImageID. + + Image ID of a image */ ImageID string @@ -77,6 +76,21 @@ type PcloudCloudinstancesImagesGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud cloudinstances images get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesImagesGetParams) WithDefaults() *PcloudCloudinstancesImagesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances images get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesImagesGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud cloudinstances images get params func (o *PcloudCloudinstancesImagesGetParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesImagesGetParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_images/pcloud_cloudinstances_images_get_responses.go b/power/client/p_cloud_images/pcloud_cloudinstances_images_get_responses.go index eafde453..d4b52ee6 100644 --- a/power/client/p_cloud_images/pcloud_cloudinstances_images_get_responses.go +++ b/power/client/p_cloud_images/pcloud_cloudinstances_images_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudCloudinstancesImagesGetReader is a Reader for the PcloudCloudinstancesImagesGet structure. @@ -24,44 +23,38 @@ type PcloudCloudinstancesImagesGetReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudCloudinstancesImagesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudCloudinstancesImagesGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudCloudinstancesImagesGetBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudCloudinstancesImagesGetUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudCloudinstancesImagesGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudCloudinstancesImagesGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudCloudinstancesImagesGetOK() *PcloudCloudinstancesImagesGetOK { return &PcloudCloudinstancesImagesGetOK{} } -/*PcloudCloudinstancesImagesGetOK handles this case with default header values. +/* PcloudCloudinstancesImagesGetOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudCloudinstancesImagesGetOK struct { func (o *PcloudCloudinstancesImagesGetOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}][%d] pcloudCloudinstancesImagesGetOK %+v", 200, o.Payload) } +func (o *PcloudCloudinstancesImagesGetOK) GetPayload() *models.Image { + return o.Payload +} func (o *PcloudCloudinstancesImagesGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudCloudinstancesImagesGetBadRequest() *PcloudCloudinstancesImagesGet return &PcloudCloudinstancesImagesGetBadRequest{} } -/*PcloudCloudinstancesImagesGetBadRequest handles this case with default header values. +/* PcloudCloudinstancesImagesGetBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudCloudinstancesImagesGetBadRequest struct { func (o *PcloudCloudinstancesImagesGetBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}][%d] pcloudCloudinstancesImagesGetBadRequest %+v", 400, o.Payload) } +func (o *PcloudCloudinstancesImagesGetBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesImagesGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudCloudinstancesImagesGetUnauthorized() *PcloudCloudinstancesImagesG return &PcloudCloudinstancesImagesGetUnauthorized{} } -/*PcloudCloudinstancesImagesGetUnauthorized handles this case with default header values. +/* PcloudCloudinstancesImagesGetUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudCloudinstancesImagesGetUnauthorized struct { func (o *PcloudCloudinstancesImagesGetUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}][%d] pcloudCloudinstancesImagesGetUnauthorized %+v", 401, o.Payload) } +func (o *PcloudCloudinstancesImagesGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesImagesGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudCloudinstancesImagesGetNotFound() *PcloudCloudinstancesImagesGetNo return &PcloudCloudinstancesImagesGetNotFound{} } -/*PcloudCloudinstancesImagesGetNotFound handles this case with default header values. +/* PcloudCloudinstancesImagesGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -168,6 +170,9 @@ type PcloudCloudinstancesImagesGetNotFound struct { func (o *PcloudCloudinstancesImagesGetNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}][%d] pcloudCloudinstancesImagesGetNotFound %+v", 404, o.Payload) } +func (o *PcloudCloudinstancesImagesGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesImagesGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudCloudinstancesImagesGetInternalServerError() *PcloudCloudinstances return &PcloudCloudinstancesImagesGetInternalServerError{} } -/*PcloudCloudinstancesImagesGetInternalServerError handles this case with default header values. +/* PcloudCloudinstancesImagesGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudCloudinstancesImagesGetInternalServerError struct { func (o *PcloudCloudinstancesImagesGetInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}][%d] pcloudCloudinstancesImagesGetInternalServerError %+v", 500, o.Payload) } +func (o *PcloudCloudinstancesImagesGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesImagesGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_images/pcloud_cloudinstances_images_getall_parameters.go b/power/client/p_cloud_images/pcloud_cloudinstances_images_getall_parameters.go index 6bcc6651..a0acea17 100644 --- a/power/client/p_cloud_images/pcloud_cloudinstances_images_getall_parameters.go +++ b/power/client/p_cloud_images/pcloud_cloudinstances_images_getall_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudCloudinstancesImagesGetallParams creates a new PcloudCloudinstancesImagesGetallParams object -// with the default values initialized. +// NewPcloudCloudinstancesImagesGetallParams creates a new PcloudCloudinstancesImagesGetallParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudCloudinstancesImagesGetallParams() *PcloudCloudinstancesImagesGetallParams { - var () return &PcloudCloudinstancesImagesGetallParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudCloudinstancesImagesGetallParamsWithTimeout creates a new PcloudCloudinstancesImagesGetallParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudCloudinstancesImagesGetallParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesImagesGetallParams { - var () return &PcloudCloudinstancesImagesGetallParams{ - timeout: timeout, } } // NewPcloudCloudinstancesImagesGetallParamsWithContext creates a new PcloudCloudinstancesImagesGetallParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudCloudinstancesImagesGetallParamsWithContext(ctx context.Context) *PcloudCloudinstancesImagesGetallParams { - var () return &PcloudCloudinstancesImagesGetallParams{ - Context: ctx, } } // NewPcloudCloudinstancesImagesGetallParamsWithHTTPClient creates a new PcloudCloudinstancesImagesGetallParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudCloudinstancesImagesGetallParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesImagesGetallParams { - var () return &PcloudCloudinstancesImagesGetallParams{ HTTPClient: client, } } -/*PcloudCloudinstancesImagesGetallParams contains all the parameters to send to the API endpoint -for the pcloud cloudinstances images getall operation typically these are written to a http.Request +/* PcloudCloudinstancesImagesGetallParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances images getall operation. + + Typically these are written to a http.Request. */ type PcloudCloudinstancesImagesGetallParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -72,6 +70,21 @@ type PcloudCloudinstancesImagesGetallParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud cloudinstances images getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesImagesGetallParams) WithDefaults() *PcloudCloudinstancesImagesGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances images getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesImagesGetallParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud cloudinstances images getall params func (o *PcloudCloudinstancesImagesGetallParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesImagesGetallParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_images/pcloud_cloudinstances_images_getall_responses.go b/power/client/p_cloud_images/pcloud_cloudinstances_images_getall_responses.go index 02b4454c..a06568fe 100644 --- a/power/client/p_cloud_images/pcloud_cloudinstances_images_getall_responses.go +++ b/power/client/p_cloud_images/pcloud_cloudinstances_images_getall_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudCloudinstancesImagesGetallReader is a Reader for the PcloudCloudinstancesImagesGetall structure. @@ -24,44 +23,38 @@ type PcloudCloudinstancesImagesGetallReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudCloudinstancesImagesGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudCloudinstancesImagesGetallOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudCloudinstancesImagesGetallBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudCloudinstancesImagesGetallUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudCloudinstancesImagesGetallNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudCloudinstancesImagesGetallInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudCloudinstancesImagesGetallOK() *PcloudCloudinstancesImagesGetallOK return &PcloudCloudinstancesImagesGetallOK{} } -/*PcloudCloudinstancesImagesGetallOK handles this case with default header values. +/* PcloudCloudinstancesImagesGetallOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudCloudinstancesImagesGetallOK struct { func (o *PcloudCloudinstancesImagesGetallOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/images][%d] pcloudCloudinstancesImagesGetallOK %+v", 200, o.Payload) } +func (o *PcloudCloudinstancesImagesGetallOK) GetPayload() *models.Images { + return o.Payload +} func (o *PcloudCloudinstancesImagesGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudCloudinstancesImagesGetallBadRequest() *PcloudCloudinstancesImages return &PcloudCloudinstancesImagesGetallBadRequest{} } -/*PcloudCloudinstancesImagesGetallBadRequest handles this case with default header values. +/* PcloudCloudinstancesImagesGetallBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudCloudinstancesImagesGetallBadRequest struct { func (o *PcloudCloudinstancesImagesGetallBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/images][%d] pcloudCloudinstancesImagesGetallBadRequest %+v", 400, o.Payload) } +func (o *PcloudCloudinstancesImagesGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesImagesGetallBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudCloudinstancesImagesGetallUnauthorized() *PcloudCloudinstancesImag return &PcloudCloudinstancesImagesGetallUnauthorized{} } -/*PcloudCloudinstancesImagesGetallUnauthorized handles this case with default header values. +/* PcloudCloudinstancesImagesGetallUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudCloudinstancesImagesGetallUnauthorized struct { func (o *PcloudCloudinstancesImagesGetallUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/images][%d] pcloudCloudinstancesImagesGetallUnauthorized %+v", 401, o.Payload) } +func (o *PcloudCloudinstancesImagesGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesImagesGetallUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudCloudinstancesImagesGetallNotFound() *PcloudCloudinstancesImagesGe return &PcloudCloudinstancesImagesGetallNotFound{} } -/*PcloudCloudinstancesImagesGetallNotFound handles this case with default header values. +/* PcloudCloudinstancesImagesGetallNotFound describes a response with status code 404, with default header values. Not Found */ @@ -168,6 +170,9 @@ type PcloudCloudinstancesImagesGetallNotFound struct { func (o *PcloudCloudinstancesImagesGetallNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/images][%d] pcloudCloudinstancesImagesGetallNotFound %+v", 404, o.Payload) } +func (o *PcloudCloudinstancesImagesGetallNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesImagesGetallNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudCloudinstancesImagesGetallInternalServerError() *PcloudCloudinstan return &PcloudCloudinstancesImagesGetallInternalServerError{} } -/*PcloudCloudinstancesImagesGetallInternalServerError handles this case with default header values. +/* PcloudCloudinstancesImagesGetallInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudCloudinstancesImagesGetallInternalServerError struct { func (o *PcloudCloudinstancesImagesGetallInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/images][%d] pcloudCloudinstancesImagesGetallInternalServerError %+v", 500, o.Payload) } +func (o *PcloudCloudinstancesImagesGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesImagesGetallInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_images/pcloud_cloudinstances_images_post_parameters.go b/power/client/p_cloud_images/pcloud_cloudinstances_images_post_parameters.go index d45fd822..cd22b7b1 100644 --- a/power/client/p_cloud_images/pcloud_cloudinstances_images_post_parameters.go +++ b/power/client/p_cloud_images/pcloud_cloudinstances_images_post_parameters.go @@ -13,64 +13,63 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudCloudinstancesImagesPostParams creates a new PcloudCloudinstancesImagesPostParams object -// with the default values initialized. +// NewPcloudCloudinstancesImagesPostParams creates a new PcloudCloudinstancesImagesPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudCloudinstancesImagesPostParams() *PcloudCloudinstancesImagesPostParams { - var () return &PcloudCloudinstancesImagesPostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudCloudinstancesImagesPostParamsWithTimeout creates a new PcloudCloudinstancesImagesPostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudCloudinstancesImagesPostParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesImagesPostParams { - var () return &PcloudCloudinstancesImagesPostParams{ - timeout: timeout, } } // NewPcloudCloudinstancesImagesPostParamsWithContext creates a new PcloudCloudinstancesImagesPostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudCloudinstancesImagesPostParamsWithContext(ctx context.Context) *PcloudCloudinstancesImagesPostParams { - var () return &PcloudCloudinstancesImagesPostParams{ - Context: ctx, } } // NewPcloudCloudinstancesImagesPostParamsWithHTTPClient creates a new PcloudCloudinstancesImagesPostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudCloudinstancesImagesPostParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesImagesPostParams { - var () return &PcloudCloudinstancesImagesPostParams{ HTTPClient: client, } } -/*PcloudCloudinstancesImagesPostParams contains all the parameters to send to the API endpoint -for the pcloud cloudinstances images post operation typically these are written to a http.Request +/* PcloudCloudinstancesImagesPostParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances images post operation. + + Typically these are written to a http.Request. */ type PcloudCloudinstancesImagesPostParams struct { - /*Body - Parameters for the creation of a new image from available images + /* Body. + Parameters for the creation of a new image from available images */ Body *models.CreateImage - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -79,6 +78,21 @@ type PcloudCloudinstancesImagesPostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud cloudinstances images post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesImagesPostParams) WithDefaults() *PcloudCloudinstancesImagesPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances images post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesImagesPostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud cloudinstances images post params func (o *PcloudCloudinstancesImagesPostParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesImagesPostParams { o.SetTimeout(timeout) @@ -141,7 +155,6 @@ func (o *PcloudCloudinstancesImagesPostParams) WriteToRequest(r runtime.ClientRe return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_images/pcloud_cloudinstances_images_post_responses.go b/power/client/p_cloud_images/pcloud_cloudinstances_images_post_responses.go index 14254d37..570d8467 100644 --- a/power/client/p_cloud_images/pcloud_cloudinstances_images_post_responses.go +++ b/power/client/p_cloud_images/pcloud_cloudinstances_images_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudCloudinstancesImagesPostReader is a Reader for the PcloudCloudinstancesImagesPost structure. @@ -24,58 +23,50 @@ type PcloudCloudinstancesImagesPostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudCloudinstancesImagesPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudCloudinstancesImagesPostOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 201: result := NewPcloudCloudinstancesImagesPostCreated() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudCloudinstancesImagesPostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudCloudinstancesImagesPostUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 409: result := NewPcloudCloudinstancesImagesPostConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudCloudinstancesImagesPostUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudCloudinstancesImagesPostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -84,7 +75,7 @@ func NewPcloudCloudinstancesImagesPostOK() *PcloudCloudinstancesImagesPostOK { return &PcloudCloudinstancesImagesPostOK{} } -/*PcloudCloudinstancesImagesPostOK handles this case with default header values. +/* PcloudCloudinstancesImagesPostOK describes a response with status code 200, with default header values. OK */ @@ -95,6 +86,9 @@ type PcloudCloudinstancesImagesPostOK struct { func (o *PcloudCloudinstancesImagesPostOK) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/images][%d] pcloudCloudinstancesImagesPostOK %+v", 200, o.Payload) } +func (o *PcloudCloudinstancesImagesPostOK) GetPayload() *models.Image { + return o.Payload +} func (o *PcloudCloudinstancesImagesPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -113,7 +107,7 @@ func NewPcloudCloudinstancesImagesPostCreated() *PcloudCloudinstancesImagesPostC return &PcloudCloudinstancesImagesPostCreated{} } -/*PcloudCloudinstancesImagesPostCreated handles this case with default header values. +/* PcloudCloudinstancesImagesPostCreated describes a response with status code 201, with default header values. Created */ @@ -124,6 +118,9 @@ type PcloudCloudinstancesImagesPostCreated struct { func (o *PcloudCloudinstancesImagesPostCreated) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/images][%d] pcloudCloudinstancesImagesPostCreated %+v", 201, o.Payload) } +func (o *PcloudCloudinstancesImagesPostCreated) GetPayload() *models.Image { + return o.Payload +} func (o *PcloudCloudinstancesImagesPostCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -142,7 +139,7 @@ func NewPcloudCloudinstancesImagesPostBadRequest() *PcloudCloudinstancesImagesPo return &PcloudCloudinstancesImagesPostBadRequest{} } -/*PcloudCloudinstancesImagesPostBadRequest handles this case with default header values. +/* PcloudCloudinstancesImagesPostBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -153,6 +150,9 @@ type PcloudCloudinstancesImagesPostBadRequest struct { func (o *PcloudCloudinstancesImagesPostBadRequest) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/images][%d] pcloudCloudinstancesImagesPostBadRequest %+v", 400, o.Payload) } +func (o *PcloudCloudinstancesImagesPostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesImagesPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -171,7 +171,7 @@ func NewPcloudCloudinstancesImagesPostUnauthorized() *PcloudCloudinstancesImages return &PcloudCloudinstancesImagesPostUnauthorized{} } -/*PcloudCloudinstancesImagesPostUnauthorized handles this case with default header values. +/* PcloudCloudinstancesImagesPostUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -182,6 +182,9 @@ type PcloudCloudinstancesImagesPostUnauthorized struct { func (o *PcloudCloudinstancesImagesPostUnauthorized) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/images][%d] pcloudCloudinstancesImagesPostUnauthorized %+v", 401, o.Payload) } +func (o *PcloudCloudinstancesImagesPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesImagesPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -200,7 +203,7 @@ func NewPcloudCloudinstancesImagesPostConflict() *PcloudCloudinstancesImagesPost return &PcloudCloudinstancesImagesPostConflict{} } -/*PcloudCloudinstancesImagesPostConflict handles this case with default header values. +/* PcloudCloudinstancesImagesPostConflict describes a response with status code 409, with default header values. Conflict */ @@ -211,6 +214,9 @@ type PcloudCloudinstancesImagesPostConflict struct { func (o *PcloudCloudinstancesImagesPostConflict) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/images][%d] pcloudCloudinstancesImagesPostConflict %+v", 409, o.Payload) } +func (o *PcloudCloudinstancesImagesPostConflict) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesImagesPostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -229,7 +235,7 @@ func NewPcloudCloudinstancesImagesPostUnprocessableEntity() *PcloudCloudinstance return &PcloudCloudinstancesImagesPostUnprocessableEntity{} } -/*PcloudCloudinstancesImagesPostUnprocessableEntity handles this case with default header values. +/* PcloudCloudinstancesImagesPostUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -240,6 +246,9 @@ type PcloudCloudinstancesImagesPostUnprocessableEntity struct { func (o *PcloudCloudinstancesImagesPostUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/images][%d] pcloudCloudinstancesImagesPostUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudCloudinstancesImagesPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesImagesPostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -258,7 +267,7 @@ func NewPcloudCloudinstancesImagesPostInternalServerError() *PcloudCloudinstance return &PcloudCloudinstancesImagesPostInternalServerError{} } -/*PcloudCloudinstancesImagesPostInternalServerError handles this case with default header values. +/* PcloudCloudinstancesImagesPostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -269,6 +278,9 @@ type PcloudCloudinstancesImagesPostInternalServerError struct { func (o *PcloudCloudinstancesImagesPostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/images][%d] pcloudCloudinstancesImagesPostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudCloudinstancesImagesPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesImagesPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_images/pcloud_cloudinstances_stockimages_get_parameters.go b/power/client/p_cloud_images/pcloud_cloudinstances_stockimages_get_parameters.go index 30f2ff8d..071d73d8 100644 --- a/power/client/p_cloud_images/pcloud_cloudinstances_stockimages_get_parameters.go +++ b/power/client/p_cloud_images/pcloud_cloudinstances_stockimages_get_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudCloudinstancesStockimagesGetParams creates a new PcloudCloudinstancesStockimagesGetParams object -// with the default values initialized. +// NewPcloudCloudinstancesStockimagesGetParams creates a new PcloudCloudinstancesStockimagesGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudCloudinstancesStockimagesGetParams() *PcloudCloudinstancesStockimagesGetParams { - var () return &PcloudCloudinstancesStockimagesGetParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudCloudinstancesStockimagesGetParamsWithTimeout creates a new PcloudCloudinstancesStockimagesGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudCloudinstancesStockimagesGetParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesStockimagesGetParams { - var () return &PcloudCloudinstancesStockimagesGetParams{ - timeout: timeout, } } // NewPcloudCloudinstancesStockimagesGetParamsWithContext creates a new PcloudCloudinstancesStockimagesGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudCloudinstancesStockimagesGetParamsWithContext(ctx context.Context) *PcloudCloudinstancesStockimagesGetParams { - var () return &PcloudCloudinstancesStockimagesGetParams{ - Context: ctx, } } // NewPcloudCloudinstancesStockimagesGetParamsWithHTTPClient creates a new PcloudCloudinstancesStockimagesGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudCloudinstancesStockimagesGetParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesStockimagesGetParams { - var () return &PcloudCloudinstancesStockimagesGetParams{ HTTPClient: client, } } -/*PcloudCloudinstancesStockimagesGetParams contains all the parameters to send to the API endpoint -for the pcloud cloudinstances stockimages get operation typically these are written to a http.Request +/* PcloudCloudinstancesStockimagesGetParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances stockimages get operation. + + Typically these are written to a http.Request. */ type PcloudCloudinstancesStockimagesGetParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*ImageID - Image ID of a image + /* ImageID. + + Image ID of a image */ ImageID string @@ -77,6 +76,21 @@ type PcloudCloudinstancesStockimagesGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud cloudinstances stockimages get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesStockimagesGetParams) WithDefaults() *PcloudCloudinstancesStockimagesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances stockimages get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesStockimagesGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud cloudinstances stockimages get params func (o *PcloudCloudinstancesStockimagesGetParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesStockimagesGetParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_images/pcloud_cloudinstances_stockimages_get_responses.go b/power/client/p_cloud_images/pcloud_cloudinstances_stockimages_get_responses.go index bbb04327..2073da1c 100644 --- a/power/client/p_cloud_images/pcloud_cloudinstances_stockimages_get_responses.go +++ b/power/client/p_cloud_images/pcloud_cloudinstances_stockimages_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudCloudinstancesStockimagesGetReader is a Reader for the PcloudCloudinstancesStockimagesGet structure. @@ -24,44 +23,38 @@ type PcloudCloudinstancesStockimagesGetReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudCloudinstancesStockimagesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudCloudinstancesStockimagesGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudCloudinstancesStockimagesGetBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudCloudinstancesStockimagesGetUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudCloudinstancesStockimagesGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudCloudinstancesStockimagesGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudCloudinstancesStockimagesGetOK() *PcloudCloudinstancesStockimagesG return &PcloudCloudinstancesStockimagesGetOK{} } -/*PcloudCloudinstancesStockimagesGetOK handles this case with default header values. +/* PcloudCloudinstancesStockimagesGetOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudCloudinstancesStockimagesGetOK struct { func (o *PcloudCloudinstancesStockimagesGetOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/stock-images/{image_id}][%d] pcloudCloudinstancesStockimagesGetOK %+v", 200, o.Payload) } +func (o *PcloudCloudinstancesStockimagesGetOK) GetPayload() *models.Image { + return o.Payload +} func (o *PcloudCloudinstancesStockimagesGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudCloudinstancesStockimagesGetBadRequest() *PcloudCloudinstancesStoc return &PcloudCloudinstancesStockimagesGetBadRequest{} } -/*PcloudCloudinstancesStockimagesGetBadRequest handles this case with default header values. +/* PcloudCloudinstancesStockimagesGetBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudCloudinstancesStockimagesGetBadRequest struct { func (o *PcloudCloudinstancesStockimagesGetBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/stock-images/{image_id}][%d] pcloudCloudinstancesStockimagesGetBadRequest %+v", 400, o.Payload) } +func (o *PcloudCloudinstancesStockimagesGetBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesStockimagesGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudCloudinstancesStockimagesGetUnauthorized() *PcloudCloudinstancesSt return &PcloudCloudinstancesStockimagesGetUnauthorized{} } -/*PcloudCloudinstancesStockimagesGetUnauthorized handles this case with default header values. +/* PcloudCloudinstancesStockimagesGetUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudCloudinstancesStockimagesGetUnauthorized struct { func (o *PcloudCloudinstancesStockimagesGetUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/stock-images/{image_id}][%d] pcloudCloudinstancesStockimagesGetUnauthorized %+v", 401, o.Payload) } +func (o *PcloudCloudinstancesStockimagesGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesStockimagesGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudCloudinstancesStockimagesGetNotFound() *PcloudCloudinstancesStocki return &PcloudCloudinstancesStockimagesGetNotFound{} } -/*PcloudCloudinstancesStockimagesGetNotFound handles this case with default header values. +/* PcloudCloudinstancesStockimagesGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -168,6 +170,9 @@ type PcloudCloudinstancesStockimagesGetNotFound struct { func (o *PcloudCloudinstancesStockimagesGetNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/stock-images/{image_id}][%d] pcloudCloudinstancesStockimagesGetNotFound %+v", 404, o.Payload) } +func (o *PcloudCloudinstancesStockimagesGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesStockimagesGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudCloudinstancesStockimagesGetInternalServerError() *PcloudCloudinst return &PcloudCloudinstancesStockimagesGetInternalServerError{} } -/*PcloudCloudinstancesStockimagesGetInternalServerError handles this case with default header values. +/* PcloudCloudinstancesStockimagesGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudCloudinstancesStockimagesGetInternalServerError struct { func (o *PcloudCloudinstancesStockimagesGetInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/stock-images/{image_id}][%d] pcloudCloudinstancesStockimagesGetInternalServerError %+v", 500, o.Payload) } +func (o *PcloudCloudinstancesStockimagesGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesStockimagesGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_images/pcloud_cloudinstances_stockimages_getall_parameters.go b/power/client/p_cloud_images/pcloud_cloudinstances_stockimages_getall_parameters.go index 52f1f03c..cec512f7 100644 --- a/power/client/p_cloud_images/pcloud_cloudinstances_stockimages_getall_parameters.go +++ b/power/client/p_cloud_images/pcloud_cloudinstances_stockimages_getall_parameters.go @@ -13,68 +13,68 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - - strfmt "github.com/go-openapi/strfmt" ) -// NewPcloudCloudinstancesStockimagesGetallParams creates a new PcloudCloudinstancesStockimagesGetallParams object -// with the default values initialized. +// NewPcloudCloudinstancesStockimagesGetallParams creates a new PcloudCloudinstancesStockimagesGetallParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudCloudinstancesStockimagesGetallParams() *PcloudCloudinstancesStockimagesGetallParams { - var () return &PcloudCloudinstancesStockimagesGetallParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudCloudinstancesStockimagesGetallParamsWithTimeout creates a new PcloudCloudinstancesStockimagesGetallParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudCloudinstancesStockimagesGetallParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesStockimagesGetallParams { - var () return &PcloudCloudinstancesStockimagesGetallParams{ - timeout: timeout, } } // NewPcloudCloudinstancesStockimagesGetallParamsWithContext creates a new PcloudCloudinstancesStockimagesGetallParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudCloudinstancesStockimagesGetallParamsWithContext(ctx context.Context) *PcloudCloudinstancesStockimagesGetallParams { - var () return &PcloudCloudinstancesStockimagesGetallParams{ - Context: ctx, } } // NewPcloudCloudinstancesStockimagesGetallParamsWithHTTPClient creates a new PcloudCloudinstancesStockimagesGetallParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudCloudinstancesStockimagesGetallParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesStockimagesGetallParams { - var () return &PcloudCloudinstancesStockimagesGetallParams{ HTTPClient: client, } } -/*PcloudCloudinstancesStockimagesGetallParams contains all the parameters to send to the API endpoint -for the pcloud cloudinstances stockimages getall operation typically these are written to a http.Request +/* PcloudCloudinstancesStockimagesGetallParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances stockimages getall operation. + + Typically these are written to a http.Request. */ type PcloudCloudinstancesStockimagesGetallParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*Sap - Include SAP images with get available stock images + /* Sap. + + Include SAP images with get available stock images */ Sap *bool - /*Vtl - Include VTL images with get available stock images + /* Vtl. + + Include VTL images with get available stock images */ Vtl *bool @@ -83,6 +83,21 @@ type PcloudCloudinstancesStockimagesGetallParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud cloudinstances stockimages getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesStockimagesGetallParams) WithDefaults() *PcloudCloudinstancesStockimagesGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances stockimages getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesStockimagesGetallParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud cloudinstances stockimages getall params func (o *PcloudCloudinstancesStockimagesGetallParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesStockimagesGetallParams { o.SetTimeout(timeout) @@ -166,32 +181,34 @@ func (o *PcloudCloudinstancesStockimagesGetallParams) WriteToRequest(r runtime.C // query param sap var qrSap bool + if o.Sap != nil { qrSap = *o.Sap } qSap := swag.FormatBool(qrSap) if qSap != "" { + if err := r.SetQueryParam("sap", qSap); err != nil { return err } } - } if o.Vtl != nil { // query param vtl var qrVtl bool + if o.Vtl != nil { qrVtl = *o.Vtl } qVtl := swag.FormatBool(qrVtl) if qVtl != "" { + if err := r.SetQueryParam("vtl", qVtl); err != nil { return err } } - } if len(res) > 0 { diff --git a/power/client/p_cloud_images/pcloud_cloudinstances_stockimages_getall_responses.go b/power/client/p_cloud_images/pcloud_cloudinstances_stockimages_getall_responses.go index 30af9166..b30c8388 100644 --- a/power/client/p_cloud_images/pcloud_cloudinstances_stockimages_getall_responses.go +++ b/power/client/p_cloud_images/pcloud_cloudinstances_stockimages_getall_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudCloudinstancesStockimagesGetallReader is a Reader for the PcloudCloudinstancesStockimagesGetall structure. @@ -24,44 +23,38 @@ type PcloudCloudinstancesStockimagesGetallReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudCloudinstancesStockimagesGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudCloudinstancesStockimagesGetallOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudCloudinstancesStockimagesGetallBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudCloudinstancesStockimagesGetallUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudCloudinstancesStockimagesGetallNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudCloudinstancesStockimagesGetallInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudCloudinstancesStockimagesGetallOK() *PcloudCloudinstancesStockimag return &PcloudCloudinstancesStockimagesGetallOK{} } -/*PcloudCloudinstancesStockimagesGetallOK handles this case with default header values. +/* PcloudCloudinstancesStockimagesGetallOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudCloudinstancesStockimagesGetallOK struct { func (o *PcloudCloudinstancesStockimagesGetallOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/stock-images][%d] pcloudCloudinstancesStockimagesGetallOK %+v", 200, o.Payload) } +func (o *PcloudCloudinstancesStockimagesGetallOK) GetPayload() *models.Images { + return o.Payload +} func (o *PcloudCloudinstancesStockimagesGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudCloudinstancesStockimagesGetallBadRequest() *PcloudCloudinstancesS return &PcloudCloudinstancesStockimagesGetallBadRequest{} } -/*PcloudCloudinstancesStockimagesGetallBadRequest handles this case with default header values. +/* PcloudCloudinstancesStockimagesGetallBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudCloudinstancesStockimagesGetallBadRequest struct { func (o *PcloudCloudinstancesStockimagesGetallBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/stock-images][%d] pcloudCloudinstancesStockimagesGetallBadRequest %+v", 400, o.Payload) } +func (o *PcloudCloudinstancesStockimagesGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesStockimagesGetallBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudCloudinstancesStockimagesGetallUnauthorized() *PcloudCloudinstance return &PcloudCloudinstancesStockimagesGetallUnauthorized{} } -/*PcloudCloudinstancesStockimagesGetallUnauthorized handles this case with default header values. +/* PcloudCloudinstancesStockimagesGetallUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudCloudinstancesStockimagesGetallUnauthorized struct { func (o *PcloudCloudinstancesStockimagesGetallUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/stock-images][%d] pcloudCloudinstancesStockimagesGetallUnauthorized %+v", 401, o.Payload) } +func (o *PcloudCloudinstancesStockimagesGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesStockimagesGetallUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudCloudinstancesStockimagesGetallNotFound() *PcloudCloudinstancesSto return &PcloudCloudinstancesStockimagesGetallNotFound{} } -/*PcloudCloudinstancesStockimagesGetallNotFound handles this case with default header values. +/* PcloudCloudinstancesStockimagesGetallNotFound describes a response with status code 404, with default header values. Not Found */ @@ -168,6 +170,9 @@ type PcloudCloudinstancesStockimagesGetallNotFound struct { func (o *PcloudCloudinstancesStockimagesGetallNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/stock-images][%d] pcloudCloudinstancesStockimagesGetallNotFound %+v", 404, o.Payload) } +func (o *PcloudCloudinstancesStockimagesGetallNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesStockimagesGetallNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudCloudinstancesStockimagesGetallInternalServerError() *PcloudCloudi return &PcloudCloudinstancesStockimagesGetallInternalServerError{} } -/*PcloudCloudinstancesStockimagesGetallInternalServerError handles this case with default header values. +/* PcloudCloudinstancesStockimagesGetallInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudCloudinstancesStockimagesGetallInternalServerError struct { func (o *PcloudCloudinstancesStockimagesGetallInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/stock-images][%d] pcloudCloudinstancesStockimagesGetallInternalServerError %+v", 500, o.Payload) } +func (o *PcloudCloudinstancesStockimagesGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesStockimagesGetallInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_images/pcloud_images_get_parameters.go b/power/client/p_cloud_images/pcloud_images_get_parameters.go index 2052bc82..91192f6f 100644 --- a/power/client/p_cloud_images/pcloud_images_get_parameters.go +++ b/power/client/p_cloud_images/pcloud_images_get_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudImagesGetParams creates a new PcloudImagesGetParams object -// with the default values initialized. +// NewPcloudImagesGetParams creates a new PcloudImagesGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudImagesGetParams() *PcloudImagesGetParams { - var () return &PcloudImagesGetParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudImagesGetParamsWithTimeout creates a new PcloudImagesGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudImagesGetParamsWithTimeout(timeout time.Duration) *PcloudImagesGetParams { - var () return &PcloudImagesGetParams{ - timeout: timeout, } } // NewPcloudImagesGetParamsWithContext creates a new PcloudImagesGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudImagesGetParamsWithContext(ctx context.Context) *PcloudImagesGetParams { - var () return &PcloudImagesGetParams{ - Context: ctx, } } // NewPcloudImagesGetParamsWithHTTPClient creates a new PcloudImagesGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudImagesGetParamsWithHTTPClient(client *http.Client) *PcloudImagesGetParams { - var () return &PcloudImagesGetParams{ HTTPClient: client, } } -/*PcloudImagesGetParams contains all the parameters to send to the API endpoint -for the pcloud images get operation typically these are written to a http.Request +/* PcloudImagesGetParams contains all the parameters to send to the API endpoint + for the pcloud images get operation. + + Typically these are written to a http.Request. */ type PcloudImagesGetParams struct { - /*ImageID - Image ID of a image + /* ImageID. + Image ID of a image */ ImageID string @@ -72,6 +70,21 @@ type PcloudImagesGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud images get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudImagesGetParams) WithDefaults() *PcloudImagesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud images get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudImagesGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud images get params func (o *PcloudImagesGetParams) WithTimeout(timeout time.Duration) *PcloudImagesGetParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_images/pcloud_images_get_responses.go b/power/client/p_cloud_images/pcloud_images_get_responses.go index a9bd635b..040e27c3 100644 --- a/power/client/p_cloud_images/pcloud_images_get_responses.go +++ b/power/client/p_cloud_images/pcloud_images_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudImagesGetReader is a Reader for the PcloudImagesGet structure. @@ -24,44 +23,38 @@ type PcloudImagesGetReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudImagesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudImagesGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudImagesGetBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudImagesGetUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudImagesGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudImagesGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudImagesGetOK() *PcloudImagesGetOK { return &PcloudImagesGetOK{} } -/*PcloudImagesGetOK handles this case with default header values. +/* PcloudImagesGetOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudImagesGetOK struct { func (o *PcloudImagesGetOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/images/{image_id}][%d] pcloudImagesGetOK %+v", 200, o.Payload) } +func (o *PcloudImagesGetOK) GetPayload() *models.Image { + return o.Payload +} func (o *PcloudImagesGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudImagesGetBadRequest() *PcloudImagesGetBadRequest { return &PcloudImagesGetBadRequest{} } -/*PcloudImagesGetBadRequest handles this case with default header values. +/* PcloudImagesGetBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudImagesGetBadRequest struct { func (o *PcloudImagesGetBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/images/{image_id}][%d] pcloudImagesGetBadRequest %+v", 400, o.Payload) } +func (o *PcloudImagesGetBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudImagesGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudImagesGetUnauthorized() *PcloudImagesGetUnauthorized { return &PcloudImagesGetUnauthorized{} } -/*PcloudImagesGetUnauthorized handles this case with default header values. +/* PcloudImagesGetUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudImagesGetUnauthorized struct { func (o *PcloudImagesGetUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/images/{image_id}][%d] pcloudImagesGetUnauthorized %+v", 401, o.Payload) } +func (o *PcloudImagesGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudImagesGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudImagesGetNotFound() *PcloudImagesGetNotFound { return &PcloudImagesGetNotFound{} } -/*PcloudImagesGetNotFound handles this case with default header values. +/* PcloudImagesGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -168,6 +170,9 @@ type PcloudImagesGetNotFound struct { func (o *PcloudImagesGetNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/images/{image_id}][%d] pcloudImagesGetNotFound %+v", 404, o.Payload) } +func (o *PcloudImagesGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudImagesGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudImagesGetInternalServerError() *PcloudImagesGetInternalServerError return &PcloudImagesGetInternalServerError{} } -/*PcloudImagesGetInternalServerError handles this case with default header values. +/* PcloudImagesGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudImagesGetInternalServerError struct { func (o *PcloudImagesGetInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/images/{image_id}][%d] pcloudImagesGetInternalServerError %+v", 500, o.Payload) } +func (o *PcloudImagesGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudImagesGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_images/pcloud_images_getall_parameters.go b/power/client/p_cloud_images/pcloud_images_getall_parameters.go index 0de7385b..cb90f6f5 100644 --- a/power/client/p_cloud_images/pcloud_images_getall_parameters.go +++ b/power/client/p_cloud_images/pcloud_images_getall_parameters.go @@ -13,63 +13,62 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - - strfmt "github.com/go-openapi/strfmt" ) -// NewPcloudImagesGetallParams creates a new PcloudImagesGetallParams object -// with the default values initialized. +// NewPcloudImagesGetallParams creates a new PcloudImagesGetallParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudImagesGetallParams() *PcloudImagesGetallParams { - var () return &PcloudImagesGetallParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudImagesGetallParamsWithTimeout creates a new PcloudImagesGetallParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudImagesGetallParamsWithTimeout(timeout time.Duration) *PcloudImagesGetallParams { - var () return &PcloudImagesGetallParams{ - timeout: timeout, } } // NewPcloudImagesGetallParamsWithContext creates a new PcloudImagesGetallParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudImagesGetallParamsWithContext(ctx context.Context) *PcloudImagesGetallParams { - var () return &PcloudImagesGetallParams{ - Context: ctx, } } // NewPcloudImagesGetallParamsWithHTTPClient creates a new PcloudImagesGetallParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudImagesGetallParamsWithHTTPClient(client *http.Client) *PcloudImagesGetallParams { - var () return &PcloudImagesGetallParams{ HTTPClient: client, } } -/*PcloudImagesGetallParams contains all the parameters to send to the API endpoint -for the pcloud images getall operation typically these are written to a http.Request +/* PcloudImagesGetallParams contains all the parameters to send to the API endpoint + for the pcloud images getall operation. + + Typically these are written to a http.Request. */ type PcloudImagesGetallParams struct { - /*Sap - Include SAP images with get available stock images + /* Sap. + Include SAP images with get available stock images */ Sap *bool - /*Vtl - Include VTL images with get available stock images + /* Vtl. + + Include VTL images with get available stock images */ Vtl *bool @@ -78,6 +77,21 @@ type PcloudImagesGetallParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud images getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudImagesGetallParams) WithDefaults() *PcloudImagesGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud images getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudImagesGetallParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud images getall params func (o *PcloudImagesGetallParams) WithTimeout(timeout time.Duration) *PcloudImagesGetallParams { o.SetTimeout(timeout) @@ -145,32 +159,34 @@ func (o *PcloudImagesGetallParams) WriteToRequest(r runtime.ClientRequest, reg s // query param sap var qrSap bool + if o.Sap != nil { qrSap = *o.Sap } qSap := swag.FormatBool(qrSap) if qSap != "" { + if err := r.SetQueryParam("sap", qSap); err != nil { return err } } - } if o.Vtl != nil { // query param vtl var qrVtl bool + if o.Vtl != nil { qrVtl = *o.Vtl } qVtl := swag.FormatBool(qrVtl) if qVtl != "" { + if err := r.SetQueryParam("vtl", qVtl); err != nil { return err } } - } if len(res) > 0 { diff --git a/power/client/p_cloud_images/pcloud_images_getall_responses.go b/power/client/p_cloud_images/pcloud_images_getall_responses.go index 242dc4a0..5be159bd 100644 --- a/power/client/p_cloud_images/pcloud_images_getall_responses.go +++ b/power/client/p_cloud_images/pcloud_images_getall_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudImagesGetallReader is a Reader for the PcloudImagesGetall structure. @@ -24,44 +23,38 @@ type PcloudImagesGetallReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudImagesGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudImagesGetallOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudImagesGetallBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudImagesGetallUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudImagesGetallNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudImagesGetallInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudImagesGetallOK() *PcloudImagesGetallOK { return &PcloudImagesGetallOK{} } -/*PcloudImagesGetallOK handles this case with default header values. +/* PcloudImagesGetallOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudImagesGetallOK struct { func (o *PcloudImagesGetallOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/images][%d] pcloudImagesGetallOK %+v", 200, o.Payload) } +func (o *PcloudImagesGetallOK) GetPayload() *models.Images { + return o.Payload +} func (o *PcloudImagesGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudImagesGetallBadRequest() *PcloudImagesGetallBadRequest { return &PcloudImagesGetallBadRequest{} } -/*PcloudImagesGetallBadRequest handles this case with default header values. +/* PcloudImagesGetallBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudImagesGetallBadRequest struct { func (o *PcloudImagesGetallBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/images][%d] pcloudImagesGetallBadRequest %+v", 400, o.Payload) } +func (o *PcloudImagesGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudImagesGetallBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudImagesGetallUnauthorized() *PcloudImagesGetallUnauthorized { return &PcloudImagesGetallUnauthorized{} } -/*PcloudImagesGetallUnauthorized handles this case with default header values. +/* PcloudImagesGetallUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudImagesGetallUnauthorized struct { func (o *PcloudImagesGetallUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/images][%d] pcloudImagesGetallUnauthorized %+v", 401, o.Payload) } +func (o *PcloudImagesGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudImagesGetallUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudImagesGetallNotFound() *PcloudImagesGetallNotFound { return &PcloudImagesGetallNotFound{} } -/*PcloudImagesGetallNotFound handles this case with default header values. +/* PcloudImagesGetallNotFound describes a response with status code 404, with default header values. Not Found */ @@ -168,6 +170,9 @@ type PcloudImagesGetallNotFound struct { func (o *PcloudImagesGetallNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/images][%d] pcloudImagesGetallNotFound %+v", 404, o.Payload) } +func (o *PcloudImagesGetallNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudImagesGetallNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudImagesGetallInternalServerError() *PcloudImagesGetallInternalServe return &PcloudImagesGetallInternalServerError{} } -/*PcloudImagesGetallInternalServerError handles this case with default header values. +/* PcloudImagesGetallInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudImagesGetallInternalServerError struct { func (o *PcloudImagesGetallInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/images][%d] pcloudImagesGetallInternalServerError %+v", 500, o.Payload) } +func (o *PcloudImagesGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudImagesGetallInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_images/pcloud_v1_cloudinstances_cosimages_get_parameters.go b/power/client/p_cloud_images/pcloud_v1_cloudinstances_cosimages_get_parameters.go index 464bfaa2..dd5a1f9a 100644 --- a/power/client/p_cloud_images/pcloud_v1_cloudinstances_cosimages_get_parameters.go +++ b/power/client/p_cloud_images/pcloud_v1_cloudinstances_cosimages_get_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudV1CloudinstancesCosimagesGetParams creates a new PcloudV1CloudinstancesCosimagesGetParams object -// with the default values initialized. +// NewPcloudV1CloudinstancesCosimagesGetParams creates a new PcloudV1CloudinstancesCosimagesGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudV1CloudinstancesCosimagesGetParams() *PcloudV1CloudinstancesCosimagesGetParams { - var () return &PcloudV1CloudinstancesCosimagesGetParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudV1CloudinstancesCosimagesGetParamsWithTimeout creates a new PcloudV1CloudinstancesCosimagesGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudV1CloudinstancesCosimagesGetParamsWithTimeout(timeout time.Duration) *PcloudV1CloudinstancesCosimagesGetParams { - var () return &PcloudV1CloudinstancesCosimagesGetParams{ - timeout: timeout, } } // NewPcloudV1CloudinstancesCosimagesGetParamsWithContext creates a new PcloudV1CloudinstancesCosimagesGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudV1CloudinstancesCosimagesGetParamsWithContext(ctx context.Context) *PcloudV1CloudinstancesCosimagesGetParams { - var () return &PcloudV1CloudinstancesCosimagesGetParams{ - Context: ctx, } } // NewPcloudV1CloudinstancesCosimagesGetParamsWithHTTPClient creates a new PcloudV1CloudinstancesCosimagesGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudV1CloudinstancesCosimagesGetParamsWithHTTPClient(client *http.Client) *PcloudV1CloudinstancesCosimagesGetParams { - var () return &PcloudV1CloudinstancesCosimagesGetParams{ HTTPClient: client, } } -/*PcloudV1CloudinstancesCosimagesGetParams contains all the parameters to send to the API endpoint -for the pcloud v1 cloudinstances cosimages get operation typically these are written to a http.Request +/* PcloudV1CloudinstancesCosimagesGetParams contains all the parameters to send to the API endpoint + for the pcloud v1 cloudinstances cosimages get operation. + + Typically these are written to a http.Request. */ type PcloudV1CloudinstancesCosimagesGetParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -72,6 +70,21 @@ type PcloudV1CloudinstancesCosimagesGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud v1 cloudinstances cosimages get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV1CloudinstancesCosimagesGetParams) WithDefaults() *PcloudV1CloudinstancesCosimagesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v1 cloudinstances cosimages get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV1CloudinstancesCosimagesGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud v1 cloudinstances cosimages get params func (o *PcloudV1CloudinstancesCosimagesGetParams) WithTimeout(timeout time.Duration) *PcloudV1CloudinstancesCosimagesGetParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_images/pcloud_v1_cloudinstances_cosimages_get_responses.go b/power/client/p_cloud_images/pcloud_v1_cloudinstances_cosimages_get_responses.go index f54dfc2f..54dad0dc 100644 --- a/power/client/p_cloud_images/pcloud_v1_cloudinstances_cosimages_get_responses.go +++ b/power/client/p_cloud_images/pcloud_v1_cloudinstances_cosimages_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudV1CloudinstancesCosimagesGetReader is a Reader for the PcloudV1CloudinstancesCosimagesGet structure. @@ -24,37 +23,32 @@ type PcloudV1CloudinstancesCosimagesGetReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudV1CloudinstancesCosimagesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudV1CloudinstancesCosimagesGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 401: result := NewPcloudV1CloudinstancesCosimagesGetUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudV1CloudinstancesCosimagesGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudV1CloudinstancesCosimagesGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -63,7 +57,7 @@ func NewPcloudV1CloudinstancesCosimagesGetOK() *PcloudV1CloudinstancesCosimagesG return &PcloudV1CloudinstancesCosimagesGetOK{} } -/*PcloudV1CloudinstancesCosimagesGetOK handles this case with default header values. +/* PcloudV1CloudinstancesCosimagesGetOK describes a response with status code 200, with default header values. OK */ @@ -74,6 +68,9 @@ type PcloudV1CloudinstancesCosimagesGetOK struct { func (o *PcloudV1CloudinstancesCosimagesGetOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cos-images][%d] pcloudV1CloudinstancesCosimagesGetOK %+v", 200, o.Payload) } +func (o *PcloudV1CloudinstancesCosimagesGetOK) GetPayload() *models.Job { + return o.Payload +} func (o *PcloudV1CloudinstancesCosimagesGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -92,7 +89,7 @@ func NewPcloudV1CloudinstancesCosimagesGetUnauthorized() *PcloudV1Cloudinstances return &PcloudV1CloudinstancesCosimagesGetUnauthorized{} } -/*PcloudV1CloudinstancesCosimagesGetUnauthorized handles this case with default header values. +/* PcloudV1CloudinstancesCosimagesGetUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -103,6 +100,9 @@ type PcloudV1CloudinstancesCosimagesGetUnauthorized struct { func (o *PcloudV1CloudinstancesCosimagesGetUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cos-images][%d] pcloudV1CloudinstancesCosimagesGetUnauthorized %+v", 401, o.Payload) } +func (o *PcloudV1CloudinstancesCosimagesGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV1CloudinstancesCosimagesGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -121,7 +121,7 @@ func NewPcloudV1CloudinstancesCosimagesGetNotFound() *PcloudV1CloudinstancesCosi return &PcloudV1CloudinstancesCosimagesGetNotFound{} } -/*PcloudV1CloudinstancesCosimagesGetNotFound handles this case with default header values. +/* PcloudV1CloudinstancesCosimagesGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -132,6 +132,9 @@ type PcloudV1CloudinstancesCosimagesGetNotFound struct { func (o *PcloudV1CloudinstancesCosimagesGetNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cos-images][%d] pcloudV1CloudinstancesCosimagesGetNotFound %+v", 404, o.Payload) } +func (o *PcloudV1CloudinstancesCosimagesGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV1CloudinstancesCosimagesGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -150,7 +153,7 @@ func NewPcloudV1CloudinstancesCosimagesGetInternalServerError() *PcloudV1Cloudin return &PcloudV1CloudinstancesCosimagesGetInternalServerError{} } -/*PcloudV1CloudinstancesCosimagesGetInternalServerError handles this case with default header values. +/* PcloudV1CloudinstancesCosimagesGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -161,6 +164,9 @@ type PcloudV1CloudinstancesCosimagesGetInternalServerError struct { func (o *PcloudV1CloudinstancesCosimagesGetInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cos-images][%d] pcloudV1CloudinstancesCosimagesGetInternalServerError %+v", 500, o.Payload) } +func (o *PcloudV1CloudinstancesCosimagesGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV1CloudinstancesCosimagesGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_images/pcloud_v1_cloudinstances_cosimages_post_parameters.go b/power/client/p_cloud_images/pcloud_v1_cloudinstances_cosimages_post_parameters.go index 66238d9c..199d9e7a 100644 --- a/power/client/p_cloud_images/pcloud_v1_cloudinstances_cosimages_post_parameters.go +++ b/power/client/p_cloud_images/pcloud_v1_cloudinstances_cosimages_post_parameters.go @@ -13,64 +13,63 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudV1CloudinstancesCosimagesPostParams creates a new PcloudV1CloudinstancesCosimagesPostParams object -// with the default values initialized. +// NewPcloudV1CloudinstancesCosimagesPostParams creates a new PcloudV1CloudinstancesCosimagesPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudV1CloudinstancesCosimagesPostParams() *PcloudV1CloudinstancesCosimagesPostParams { - var () return &PcloudV1CloudinstancesCosimagesPostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudV1CloudinstancesCosimagesPostParamsWithTimeout creates a new PcloudV1CloudinstancesCosimagesPostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudV1CloudinstancesCosimagesPostParamsWithTimeout(timeout time.Duration) *PcloudV1CloudinstancesCosimagesPostParams { - var () return &PcloudV1CloudinstancesCosimagesPostParams{ - timeout: timeout, } } // NewPcloudV1CloudinstancesCosimagesPostParamsWithContext creates a new PcloudV1CloudinstancesCosimagesPostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudV1CloudinstancesCosimagesPostParamsWithContext(ctx context.Context) *PcloudV1CloudinstancesCosimagesPostParams { - var () return &PcloudV1CloudinstancesCosimagesPostParams{ - Context: ctx, } } // NewPcloudV1CloudinstancesCosimagesPostParamsWithHTTPClient creates a new PcloudV1CloudinstancesCosimagesPostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudV1CloudinstancesCosimagesPostParamsWithHTTPClient(client *http.Client) *PcloudV1CloudinstancesCosimagesPostParams { - var () return &PcloudV1CloudinstancesCosimagesPostParams{ HTTPClient: client, } } -/*PcloudV1CloudinstancesCosimagesPostParams contains all the parameters to send to the API endpoint -for the pcloud v1 cloudinstances cosimages post operation typically these are written to a http.Request +/* PcloudV1CloudinstancesCosimagesPostParams contains all the parameters to send to the API endpoint + for the pcloud v1 cloudinstances cosimages post operation. + + Typically these are written to a http.Request. */ type PcloudV1CloudinstancesCosimagesPostParams struct { - /*Body - Parameters for the creation of a new cos-image import job + /* Body. + Parameters for the creation of a new cos-image import job */ Body *models.CreateCosImageImportJob - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -79,6 +78,21 @@ type PcloudV1CloudinstancesCosimagesPostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud v1 cloudinstances cosimages post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV1CloudinstancesCosimagesPostParams) WithDefaults() *PcloudV1CloudinstancesCosimagesPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v1 cloudinstances cosimages post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV1CloudinstancesCosimagesPostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud v1 cloudinstances cosimages post params func (o *PcloudV1CloudinstancesCosimagesPostParams) WithTimeout(timeout time.Duration) *PcloudV1CloudinstancesCosimagesPostParams { o.SetTimeout(timeout) @@ -141,7 +155,6 @@ func (o *PcloudV1CloudinstancesCosimagesPostParams) WriteToRequest(r runtime.Cli return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_images/pcloud_v1_cloudinstances_cosimages_post_responses.go b/power/client/p_cloud_images/pcloud_v1_cloudinstances_cosimages_post_responses.go index 5e0b391b..ac1a8d0a 100644 --- a/power/client/p_cloud_images/pcloud_v1_cloudinstances_cosimages_post_responses.go +++ b/power/client/p_cloud_images/pcloud_v1_cloudinstances_cosimages_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudV1CloudinstancesCosimagesPostReader is a Reader for the PcloudV1CloudinstancesCosimagesPost structure. @@ -24,58 +23,50 @@ type PcloudV1CloudinstancesCosimagesPostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudV1CloudinstancesCosimagesPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 202: result := NewPcloudV1CloudinstancesCosimagesPostAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudV1CloudinstancesCosimagesPostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudV1CloudinstancesCosimagesPostUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 403: result := NewPcloudV1CloudinstancesCosimagesPostForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 409: result := NewPcloudV1CloudinstancesCosimagesPostConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudV1CloudinstancesCosimagesPostUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudV1CloudinstancesCosimagesPostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -84,7 +75,7 @@ func NewPcloudV1CloudinstancesCosimagesPostAccepted() *PcloudV1CloudinstancesCos return &PcloudV1CloudinstancesCosimagesPostAccepted{} } -/*PcloudV1CloudinstancesCosimagesPostAccepted handles this case with default header values. +/* PcloudV1CloudinstancesCosimagesPostAccepted describes a response with status code 202, with default header values. Accepted, cos-image import successfully added to the jobs queue */ @@ -95,6 +86,9 @@ type PcloudV1CloudinstancesCosimagesPostAccepted struct { func (o *PcloudV1CloudinstancesCosimagesPostAccepted) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/cos-images][%d] pcloudV1CloudinstancesCosimagesPostAccepted %+v", 202, o.Payload) } +func (o *PcloudV1CloudinstancesCosimagesPostAccepted) GetPayload() *models.JobReference { + return o.Payload +} func (o *PcloudV1CloudinstancesCosimagesPostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -113,7 +107,7 @@ func NewPcloudV1CloudinstancesCosimagesPostBadRequest() *PcloudV1CloudinstancesC return &PcloudV1CloudinstancesCosimagesPostBadRequest{} } -/*PcloudV1CloudinstancesCosimagesPostBadRequest handles this case with default header values. +/* PcloudV1CloudinstancesCosimagesPostBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -124,6 +118,9 @@ type PcloudV1CloudinstancesCosimagesPostBadRequest struct { func (o *PcloudV1CloudinstancesCosimagesPostBadRequest) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/cos-images][%d] pcloudV1CloudinstancesCosimagesPostBadRequest %+v", 400, o.Payload) } +func (o *PcloudV1CloudinstancesCosimagesPostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV1CloudinstancesCosimagesPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -142,7 +139,7 @@ func NewPcloudV1CloudinstancesCosimagesPostUnauthorized() *PcloudV1Cloudinstance return &PcloudV1CloudinstancesCosimagesPostUnauthorized{} } -/*PcloudV1CloudinstancesCosimagesPostUnauthorized handles this case with default header values. +/* PcloudV1CloudinstancesCosimagesPostUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -153,6 +150,9 @@ type PcloudV1CloudinstancesCosimagesPostUnauthorized struct { func (o *PcloudV1CloudinstancesCosimagesPostUnauthorized) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/cos-images][%d] pcloudV1CloudinstancesCosimagesPostUnauthorized %+v", 401, o.Payload) } +func (o *PcloudV1CloudinstancesCosimagesPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV1CloudinstancesCosimagesPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -171,7 +171,7 @@ func NewPcloudV1CloudinstancesCosimagesPostForbidden() *PcloudV1CloudinstancesCo return &PcloudV1CloudinstancesCosimagesPostForbidden{} } -/*PcloudV1CloudinstancesCosimagesPostForbidden handles this case with default header values. +/* PcloudV1CloudinstancesCosimagesPostForbidden describes a response with status code 403, with default header values. Forbidden */ @@ -182,6 +182,9 @@ type PcloudV1CloudinstancesCosimagesPostForbidden struct { func (o *PcloudV1CloudinstancesCosimagesPostForbidden) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/cos-images][%d] pcloudV1CloudinstancesCosimagesPostForbidden %+v", 403, o.Payload) } +func (o *PcloudV1CloudinstancesCosimagesPostForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV1CloudinstancesCosimagesPostForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -200,7 +203,7 @@ func NewPcloudV1CloudinstancesCosimagesPostConflict() *PcloudV1CloudinstancesCos return &PcloudV1CloudinstancesCosimagesPostConflict{} } -/*PcloudV1CloudinstancesCosimagesPostConflict handles this case with default header values. +/* PcloudV1CloudinstancesCosimagesPostConflict describes a response with status code 409, with default header values. Conflict */ @@ -211,6 +214,9 @@ type PcloudV1CloudinstancesCosimagesPostConflict struct { func (o *PcloudV1CloudinstancesCosimagesPostConflict) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/cos-images][%d] pcloudV1CloudinstancesCosimagesPostConflict %+v", 409, o.Payload) } +func (o *PcloudV1CloudinstancesCosimagesPostConflict) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV1CloudinstancesCosimagesPostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -229,7 +235,7 @@ func NewPcloudV1CloudinstancesCosimagesPostUnprocessableEntity() *PcloudV1Cloudi return &PcloudV1CloudinstancesCosimagesPostUnprocessableEntity{} } -/*PcloudV1CloudinstancesCosimagesPostUnprocessableEntity handles this case with default header values. +/* PcloudV1CloudinstancesCosimagesPostUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -240,6 +246,9 @@ type PcloudV1CloudinstancesCosimagesPostUnprocessableEntity struct { func (o *PcloudV1CloudinstancesCosimagesPostUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/cos-images][%d] pcloudV1CloudinstancesCosimagesPostUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudV1CloudinstancesCosimagesPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV1CloudinstancesCosimagesPostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -258,7 +267,7 @@ func NewPcloudV1CloudinstancesCosimagesPostInternalServerError() *PcloudV1Cloudi return &PcloudV1CloudinstancesCosimagesPostInternalServerError{} } -/*PcloudV1CloudinstancesCosimagesPostInternalServerError handles this case with default header values. +/* PcloudV1CloudinstancesCosimagesPostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -269,6 +278,9 @@ type PcloudV1CloudinstancesCosimagesPostInternalServerError struct { func (o *PcloudV1CloudinstancesCosimagesPostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/cos-images][%d] pcloudV1CloudinstancesCosimagesPostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudV1CloudinstancesCosimagesPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV1CloudinstancesCosimagesPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_images/pcloud_v2_images_export_get_parameters.go b/power/client/p_cloud_images/pcloud_v2_images_export_get_parameters.go index c4cb6d2a..6a7f12b2 100644 --- a/power/client/p_cloud_images/pcloud_v2_images_export_get_parameters.go +++ b/power/client/p_cloud_images/pcloud_v2_images_export_get_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudV2ImagesExportGetParams creates a new PcloudV2ImagesExportGetParams object -// with the default values initialized. +// NewPcloudV2ImagesExportGetParams creates a new PcloudV2ImagesExportGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudV2ImagesExportGetParams() *PcloudV2ImagesExportGetParams { - var () return &PcloudV2ImagesExportGetParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudV2ImagesExportGetParamsWithTimeout creates a new PcloudV2ImagesExportGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudV2ImagesExportGetParamsWithTimeout(timeout time.Duration) *PcloudV2ImagesExportGetParams { - var () return &PcloudV2ImagesExportGetParams{ - timeout: timeout, } } // NewPcloudV2ImagesExportGetParamsWithContext creates a new PcloudV2ImagesExportGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudV2ImagesExportGetParamsWithContext(ctx context.Context) *PcloudV2ImagesExportGetParams { - var () return &PcloudV2ImagesExportGetParams{ - Context: ctx, } } // NewPcloudV2ImagesExportGetParamsWithHTTPClient creates a new PcloudV2ImagesExportGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudV2ImagesExportGetParamsWithHTTPClient(client *http.Client) *PcloudV2ImagesExportGetParams { - var () return &PcloudV2ImagesExportGetParams{ HTTPClient: client, } } -/*PcloudV2ImagesExportGetParams contains all the parameters to send to the API endpoint -for the pcloud v2 images export get operation typically these are written to a http.Request +/* PcloudV2ImagesExportGetParams contains all the parameters to send to the API endpoint + for the pcloud v2 images export get operation. + + Typically these are written to a http.Request. */ type PcloudV2ImagesExportGetParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*ImageID - Image ID of a image + /* ImageID. + + Image ID of a image */ ImageID string @@ -77,6 +76,21 @@ type PcloudV2ImagesExportGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud v2 images export get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2ImagesExportGetParams) WithDefaults() *PcloudV2ImagesExportGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v2 images export get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2ImagesExportGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud v2 images export get params func (o *PcloudV2ImagesExportGetParams) WithTimeout(timeout time.Duration) *PcloudV2ImagesExportGetParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_images/pcloud_v2_images_export_get_responses.go b/power/client/p_cloud_images/pcloud_v2_images_export_get_responses.go index 72cba5f3..a5c695a1 100644 --- a/power/client/p_cloud_images/pcloud_v2_images_export_get_responses.go +++ b/power/client/p_cloud_images/pcloud_v2_images_export_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudV2ImagesExportGetReader is a Reader for the PcloudV2ImagesExportGet structure. @@ -24,37 +23,32 @@ type PcloudV2ImagesExportGetReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudV2ImagesExportGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudV2ImagesExportGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 401: result := NewPcloudV2ImagesExportGetUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudV2ImagesExportGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudV2ImagesExportGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -63,7 +57,7 @@ func NewPcloudV2ImagesExportGetOK() *PcloudV2ImagesExportGetOK { return &PcloudV2ImagesExportGetOK{} } -/*PcloudV2ImagesExportGetOK handles this case with default header values. +/* PcloudV2ImagesExportGetOK describes a response with status code 200, with default header values. OK */ @@ -74,6 +68,9 @@ type PcloudV2ImagesExportGetOK struct { func (o *PcloudV2ImagesExportGetOK) Error() string { return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/images/{image_id}/export][%d] pcloudV2ImagesExportGetOK %+v", 200, o.Payload) } +func (o *PcloudV2ImagesExportGetOK) GetPayload() *models.Job { + return o.Payload +} func (o *PcloudV2ImagesExportGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -92,7 +89,7 @@ func NewPcloudV2ImagesExportGetUnauthorized() *PcloudV2ImagesExportGetUnauthoriz return &PcloudV2ImagesExportGetUnauthorized{} } -/*PcloudV2ImagesExportGetUnauthorized handles this case with default header values. +/* PcloudV2ImagesExportGetUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -103,6 +100,9 @@ type PcloudV2ImagesExportGetUnauthorized struct { func (o *PcloudV2ImagesExportGetUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/images/{image_id}/export][%d] pcloudV2ImagesExportGetUnauthorized %+v", 401, o.Payload) } +func (o *PcloudV2ImagesExportGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2ImagesExportGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -121,7 +121,7 @@ func NewPcloudV2ImagesExportGetNotFound() *PcloudV2ImagesExportGetNotFound { return &PcloudV2ImagesExportGetNotFound{} } -/*PcloudV2ImagesExportGetNotFound handles this case with default header values. +/* PcloudV2ImagesExportGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -132,6 +132,9 @@ type PcloudV2ImagesExportGetNotFound struct { func (o *PcloudV2ImagesExportGetNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/images/{image_id}/export][%d] pcloudV2ImagesExportGetNotFound %+v", 404, o.Payload) } +func (o *PcloudV2ImagesExportGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2ImagesExportGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -150,7 +153,7 @@ func NewPcloudV2ImagesExportGetInternalServerError() *PcloudV2ImagesExportGetInt return &PcloudV2ImagesExportGetInternalServerError{} } -/*PcloudV2ImagesExportGetInternalServerError handles this case with default header values. +/* PcloudV2ImagesExportGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -161,6 +164,9 @@ type PcloudV2ImagesExportGetInternalServerError struct { func (o *PcloudV2ImagesExportGetInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/images/{image_id}/export][%d] pcloudV2ImagesExportGetInternalServerError %+v", 500, o.Payload) } +func (o *PcloudV2ImagesExportGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2ImagesExportGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_images/pcloud_v2_images_export_post_parameters.go b/power/client/p_cloud_images/pcloud_v2_images_export_post_parameters.go index ff50da7f..da0c0be1 100644 --- a/power/client/p_cloud_images/pcloud_v2_images_export_post_parameters.go +++ b/power/client/p_cloud_images/pcloud_v2_images_export_post_parameters.go @@ -13,69 +13,69 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudV2ImagesExportPostParams creates a new PcloudV2ImagesExportPostParams object -// with the default values initialized. +// NewPcloudV2ImagesExportPostParams creates a new PcloudV2ImagesExportPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudV2ImagesExportPostParams() *PcloudV2ImagesExportPostParams { - var () return &PcloudV2ImagesExportPostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudV2ImagesExportPostParamsWithTimeout creates a new PcloudV2ImagesExportPostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudV2ImagesExportPostParamsWithTimeout(timeout time.Duration) *PcloudV2ImagesExportPostParams { - var () return &PcloudV2ImagesExportPostParams{ - timeout: timeout, } } // NewPcloudV2ImagesExportPostParamsWithContext creates a new PcloudV2ImagesExportPostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudV2ImagesExportPostParamsWithContext(ctx context.Context) *PcloudV2ImagesExportPostParams { - var () return &PcloudV2ImagesExportPostParams{ - Context: ctx, } } // NewPcloudV2ImagesExportPostParamsWithHTTPClient creates a new PcloudV2ImagesExportPostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudV2ImagesExportPostParamsWithHTTPClient(client *http.Client) *PcloudV2ImagesExportPostParams { - var () return &PcloudV2ImagesExportPostParams{ HTTPClient: client, } } -/*PcloudV2ImagesExportPostParams contains all the parameters to send to the API endpoint -for the pcloud v2 images export post operation typically these are written to a http.Request +/* PcloudV2ImagesExportPostParams contains all the parameters to send to the API endpoint + for the pcloud v2 images export post operation. + + Typically these are written to a http.Request. */ type PcloudV2ImagesExportPostParams struct { - /*Body - Parameters for the export + /* Body. + Parameters for the export */ Body *models.ExportImage - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*ImageID - Image ID of a image + /* ImageID. + + Image ID of a image */ ImageID string @@ -84,6 +84,21 @@ type PcloudV2ImagesExportPostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud v2 images export post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2ImagesExportPostParams) WithDefaults() *PcloudV2ImagesExportPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v2 images export post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2ImagesExportPostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud v2 images export post params func (o *PcloudV2ImagesExportPostParams) WithTimeout(timeout time.Duration) *PcloudV2ImagesExportPostParams { o.SetTimeout(timeout) @@ -157,7 +172,6 @@ func (o *PcloudV2ImagesExportPostParams) WriteToRequest(r runtime.ClientRequest, return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_images/pcloud_v2_images_export_post_responses.go b/power/client/p_cloud_images/pcloud_v2_images_export_post_responses.go index b97d934e..43957ae2 100644 --- a/power/client/p_cloud_images/pcloud_v2_images_export_post_responses.go +++ b/power/client/p_cloud_images/pcloud_v2_images_export_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudV2ImagesExportPostReader is a Reader for the PcloudV2ImagesExportPost structure. @@ -24,58 +23,50 @@ type PcloudV2ImagesExportPostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudV2ImagesExportPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 202: result := NewPcloudV2ImagesExportPostAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudV2ImagesExportPostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudV2ImagesExportPostUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudV2ImagesExportPostNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 409: result := NewPcloudV2ImagesExportPostConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudV2ImagesExportPostUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudV2ImagesExportPostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -84,7 +75,7 @@ func NewPcloudV2ImagesExportPostAccepted() *PcloudV2ImagesExportPostAccepted { return &PcloudV2ImagesExportPostAccepted{} } -/*PcloudV2ImagesExportPostAccepted handles this case with default header values. +/* PcloudV2ImagesExportPostAccepted describes a response with status code 202, with default header values. Accepted, image export successfully added to the jobs queue */ @@ -95,6 +86,9 @@ type PcloudV2ImagesExportPostAccepted struct { func (o *PcloudV2ImagesExportPostAccepted) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/images/{image_id}/export][%d] pcloudV2ImagesExportPostAccepted %+v", 202, o.Payload) } +func (o *PcloudV2ImagesExportPostAccepted) GetPayload() *models.JobReference { + return o.Payload +} func (o *PcloudV2ImagesExportPostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -113,7 +107,7 @@ func NewPcloudV2ImagesExportPostBadRequest() *PcloudV2ImagesExportPostBadRequest return &PcloudV2ImagesExportPostBadRequest{} } -/*PcloudV2ImagesExportPostBadRequest handles this case with default header values. +/* PcloudV2ImagesExportPostBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -124,6 +118,9 @@ type PcloudV2ImagesExportPostBadRequest struct { func (o *PcloudV2ImagesExportPostBadRequest) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/images/{image_id}/export][%d] pcloudV2ImagesExportPostBadRequest %+v", 400, o.Payload) } +func (o *PcloudV2ImagesExportPostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2ImagesExportPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -142,7 +139,7 @@ func NewPcloudV2ImagesExportPostUnauthorized() *PcloudV2ImagesExportPostUnauthor return &PcloudV2ImagesExportPostUnauthorized{} } -/*PcloudV2ImagesExportPostUnauthorized handles this case with default header values. +/* PcloudV2ImagesExportPostUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -153,6 +150,9 @@ type PcloudV2ImagesExportPostUnauthorized struct { func (o *PcloudV2ImagesExportPostUnauthorized) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/images/{image_id}/export][%d] pcloudV2ImagesExportPostUnauthorized %+v", 401, o.Payload) } +func (o *PcloudV2ImagesExportPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2ImagesExportPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -171,7 +171,7 @@ func NewPcloudV2ImagesExportPostNotFound() *PcloudV2ImagesExportPostNotFound { return &PcloudV2ImagesExportPostNotFound{} } -/*PcloudV2ImagesExportPostNotFound handles this case with default header values. +/* PcloudV2ImagesExportPostNotFound describes a response with status code 404, with default header values. image id not found */ @@ -182,6 +182,9 @@ type PcloudV2ImagesExportPostNotFound struct { func (o *PcloudV2ImagesExportPostNotFound) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/images/{image_id}/export][%d] pcloudV2ImagesExportPostNotFound %+v", 404, o.Payload) } +func (o *PcloudV2ImagesExportPostNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2ImagesExportPostNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -200,7 +203,7 @@ func NewPcloudV2ImagesExportPostConflict() *PcloudV2ImagesExportPostConflict { return &PcloudV2ImagesExportPostConflict{} } -/*PcloudV2ImagesExportPostConflict handles this case with default header values. +/* PcloudV2ImagesExportPostConflict describes a response with status code 409, with default header values. Conflict, a conflict has prevented adding image export job */ @@ -211,6 +214,9 @@ type PcloudV2ImagesExportPostConflict struct { func (o *PcloudV2ImagesExportPostConflict) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/images/{image_id}/export][%d] pcloudV2ImagesExportPostConflict %+v", 409, o.Payload) } +func (o *PcloudV2ImagesExportPostConflict) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2ImagesExportPostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -229,7 +235,7 @@ func NewPcloudV2ImagesExportPostUnprocessableEntity() *PcloudV2ImagesExportPostU return &PcloudV2ImagesExportPostUnprocessableEntity{} } -/*PcloudV2ImagesExportPostUnprocessableEntity handles this case with default header values. +/* PcloudV2ImagesExportPostUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -240,6 +246,9 @@ type PcloudV2ImagesExportPostUnprocessableEntity struct { func (o *PcloudV2ImagesExportPostUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/images/{image_id}/export][%d] pcloudV2ImagesExportPostUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudV2ImagesExportPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2ImagesExportPostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -258,7 +267,7 @@ func NewPcloudV2ImagesExportPostInternalServerError() *PcloudV2ImagesExportPostI return &PcloudV2ImagesExportPostInternalServerError{} } -/*PcloudV2ImagesExportPostInternalServerError handles this case with default header values. +/* PcloudV2ImagesExportPostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -269,6 +278,9 @@ type PcloudV2ImagesExportPostInternalServerError struct { func (o *PcloudV2ImagesExportPostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/images/{image_id}/export][%d] pcloudV2ImagesExportPostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudV2ImagesExportPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2ImagesExportPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_instances/p_cloud_instances_client.go b/power/client/p_cloud_instances/p_cloud_instances_client.go index 512cca71..b8c3c3c8 100644 --- a/power/client/p_cloud_instances/p_cloud_instances_client.go +++ b/power/client/p_cloud_instances/p_cloud_instances_client.go @@ -6,13 +6,14 @@ package p_cloud_instances // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/runtime" + "fmt" - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" ) // New creates a new p cloud instances API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { return &Client{transport: transport, formats: formats} } @@ -24,16 +25,29 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudCloudinstancesDelete(params *PcloudCloudinstancesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesDeleteOK, error) + + PcloudCloudinstancesGet(params *PcloudCloudinstancesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesGetOK, error) + + PcloudCloudinstancesPut(params *PcloudCloudinstancesPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesPutOK, error) + + SetTransport(transport runtime.ClientTransport) +} + /* -PcloudCloudinstancesDelete deletes a power cloud instance + PcloudCloudinstancesDelete deletes a power cloud instance */ -func (a *Client) PcloudCloudinstancesDelete(params *PcloudCloudinstancesDeleteParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudCloudinstancesDeleteOK, error) { +func (a *Client) PcloudCloudinstancesDelete(params *PcloudCloudinstancesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesDeleteOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudCloudinstancesDeleteParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.cloudinstances.delete", Method: "DELETE", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}", @@ -45,24 +59,34 @@ func (a *Client) PcloudCloudinstancesDelete(params *PcloudCloudinstancesDeletePa AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudCloudinstancesDeleteOK), nil - + success, ok := result.(*PcloudCloudinstancesDeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.cloudinstances.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudCloudinstancesGet gets a cloud instance s current state information + PcloudCloudinstancesGet gets a cloud instance s current state information */ -func (a *Client) PcloudCloudinstancesGet(params *PcloudCloudinstancesGetParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudCloudinstancesGetOK, error) { +func (a *Client) PcloudCloudinstancesGet(params *PcloudCloudinstancesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudCloudinstancesGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.cloudinstances.get", Method: "GET", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}", @@ -74,24 +98,34 @@ func (a *Client) PcloudCloudinstancesGet(params *PcloudCloudinstancesGetParams, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudCloudinstancesGetOK), nil - + success, ok := result.(*PcloudCloudinstancesGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.cloudinstances.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudCloudinstancesPut updates upgrade a cloud instance + PcloudCloudinstancesPut updates upgrade a cloud instance */ -func (a *Client) PcloudCloudinstancesPut(params *PcloudCloudinstancesPutParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudCloudinstancesPutOK, error) { +func (a *Client) PcloudCloudinstancesPut(params *PcloudCloudinstancesPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesPutOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudCloudinstancesPutParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.cloudinstances.put", Method: "PUT", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}", @@ -103,12 +137,23 @@ func (a *Client) PcloudCloudinstancesPut(params *PcloudCloudinstancesPutParams, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudCloudinstancesPutOK), nil - + success, ok := result.(*PcloudCloudinstancesPutOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.cloudinstances.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } // SetTransport changes the transport on the client diff --git a/power/client/p_cloud_instances/pcloud_cloudinstances_delete_parameters.go b/power/client/p_cloud_instances/pcloud_cloudinstances_delete_parameters.go index a55acf93..e375cf16 100644 --- a/power/client/p_cloud_instances/pcloud_cloudinstances_delete_parameters.go +++ b/power/client/p_cloud_instances/pcloud_cloudinstances_delete_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudCloudinstancesDeleteParams creates a new PcloudCloudinstancesDeleteParams object -// with the default values initialized. +// NewPcloudCloudinstancesDeleteParams creates a new PcloudCloudinstancesDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudCloudinstancesDeleteParams() *PcloudCloudinstancesDeleteParams { - var () return &PcloudCloudinstancesDeleteParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudCloudinstancesDeleteParamsWithTimeout creates a new PcloudCloudinstancesDeleteParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudCloudinstancesDeleteParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesDeleteParams { - var () return &PcloudCloudinstancesDeleteParams{ - timeout: timeout, } } // NewPcloudCloudinstancesDeleteParamsWithContext creates a new PcloudCloudinstancesDeleteParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudCloudinstancesDeleteParamsWithContext(ctx context.Context) *PcloudCloudinstancesDeleteParams { - var () return &PcloudCloudinstancesDeleteParams{ - Context: ctx, } } // NewPcloudCloudinstancesDeleteParamsWithHTTPClient creates a new PcloudCloudinstancesDeleteParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudCloudinstancesDeleteParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesDeleteParams { - var () return &PcloudCloudinstancesDeleteParams{ HTTPClient: client, } } -/*PcloudCloudinstancesDeleteParams contains all the parameters to send to the API endpoint -for the pcloud cloudinstances delete operation typically these are written to a http.Request +/* PcloudCloudinstancesDeleteParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances delete operation. + + Typically these are written to a http.Request. */ type PcloudCloudinstancesDeleteParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -72,6 +70,21 @@ type PcloudCloudinstancesDeleteParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud cloudinstances delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesDeleteParams) WithDefaults() *PcloudCloudinstancesDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud cloudinstances delete params func (o *PcloudCloudinstancesDeleteParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesDeleteParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_instances/pcloud_cloudinstances_delete_responses.go b/power/client/p_cloud_instances/pcloud_cloudinstances_delete_responses.go index c9d96800..6bd8adbb 100644 --- a/power/client/p_cloud_instances/pcloud_cloudinstances_delete_responses.go +++ b/power/client/p_cloud_instances/pcloud_cloudinstances_delete_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudCloudinstancesDeleteReader is a Reader for the PcloudCloudinstancesDelete structure. @@ -24,44 +23,38 @@ type PcloudCloudinstancesDeleteReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudCloudinstancesDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudCloudinstancesDeleteOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudCloudinstancesDeleteBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudCloudinstancesDeleteUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 410: result := NewPcloudCloudinstancesDeleteGone() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudCloudinstancesDeleteInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudCloudinstancesDeleteOK() *PcloudCloudinstancesDeleteOK { return &PcloudCloudinstancesDeleteOK{} } -/*PcloudCloudinstancesDeleteOK handles this case with default header values. +/* PcloudCloudinstancesDeleteOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudCloudinstancesDeleteOK struct { func (o *PcloudCloudinstancesDeleteOK) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}][%d] pcloudCloudinstancesDeleteOK %+v", 200, o.Payload) } +func (o *PcloudCloudinstancesDeleteOK) GetPayload() models.Object { + return o.Payload +} func (o *PcloudCloudinstancesDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -97,7 +93,7 @@ func NewPcloudCloudinstancesDeleteBadRequest() *PcloudCloudinstancesDeleteBadReq return &PcloudCloudinstancesDeleteBadRequest{} } -/*PcloudCloudinstancesDeleteBadRequest handles this case with default header values. +/* PcloudCloudinstancesDeleteBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -108,6 +104,9 @@ type PcloudCloudinstancesDeleteBadRequest struct { func (o *PcloudCloudinstancesDeleteBadRequest) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}][%d] pcloudCloudinstancesDeleteBadRequest %+v", 400, o.Payload) } +func (o *PcloudCloudinstancesDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -126,7 +125,7 @@ func NewPcloudCloudinstancesDeleteUnauthorized() *PcloudCloudinstancesDeleteUnau return &PcloudCloudinstancesDeleteUnauthorized{} } -/*PcloudCloudinstancesDeleteUnauthorized handles this case with default header values. +/* PcloudCloudinstancesDeleteUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -137,6 +136,9 @@ type PcloudCloudinstancesDeleteUnauthorized struct { func (o *PcloudCloudinstancesDeleteUnauthorized) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}][%d] pcloudCloudinstancesDeleteUnauthorized %+v", 401, o.Payload) } +func (o *PcloudCloudinstancesDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -155,7 +157,7 @@ func NewPcloudCloudinstancesDeleteGone() *PcloudCloudinstancesDeleteGone { return &PcloudCloudinstancesDeleteGone{} } -/*PcloudCloudinstancesDeleteGone handles this case with default header values. +/* PcloudCloudinstancesDeleteGone describes a response with status code 410, with default header values. Gone */ @@ -166,6 +168,9 @@ type PcloudCloudinstancesDeleteGone struct { func (o *PcloudCloudinstancesDeleteGone) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}][%d] pcloudCloudinstancesDeleteGone %+v", 410, o.Payload) } +func (o *PcloudCloudinstancesDeleteGone) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesDeleteGone) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -184,7 +189,7 @@ func NewPcloudCloudinstancesDeleteInternalServerError() *PcloudCloudinstancesDel return &PcloudCloudinstancesDeleteInternalServerError{} } -/*PcloudCloudinstancesDeleteInternalServerError handles this case with default header values. +/* PcloudCloudinstancesDeleteInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -195,6 +200,9 @@ type PcloudCloudinstancesDeleteInternalServerError struct { func (o *PcloudCloudinstancesDeleteInternalServerError) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}][%d] pcloudCloudinstancesDeleteInternalServerError %+v", 500, o.Payload) } +func (o *PcloudCloudinstancesDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_instances/pcloud_cloudinstances_get_parameters.go b/power/client/p_cloud_instances/pcloud_cloudinstances_get_parameters.go index 2ee7da64..4eda9ee4 100644 --- a/power/client/p_cloud_instances/pcloud_cloudinstances_get_parameters.go +++ b/power/client/p_cloud_instances/pcloud_cloudinstances_get_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudCloudinstancesGetParams creates a new PcloudCloudinstancesGetParams object -// with the default values initialized. +// NewPcloudCloudinstancesGetParams creates a new PcloudCloudinstancesGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudCloudinstancesGetParams() *PcloudCloudinstancesGetParams { - var () return &PcloudCloudinstancesGetParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudCloudinstancesGetParamsWithTimeout creates a new PcloudCloudinstancesGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudCloudinstancesGetParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesGetParams { - var () return &PcloudCloudinstancesGetParams{ - timeout: timeout, } } // NewPcloudCloudinstancesGetParamsWithContext creates a new PcloudCloudinstancesGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudCloudinstancesGetParamsWithContext(ctx context.Context) *PcloudCloudinstancesGetParams { - var () return &PcloudCloudinstancesGetParams{ - Context: ctx, } } // NewPcloudCloudinstancesGetParamsWithHTTPClient creates a new PcloudCloudinstancesGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudCloudinstancesGetParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesGetParams { - var () return &PcloudCloudinstancesGetParams{ HTTPClient: client, } } -/*PcloudCloudinstancesGetParams contains all the parameters to send to the API endpoint -for the pcloud cloudinstances get operation typically these are written to a http.Request +/* PcloudCloudinstancesGetParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances get operation. + + Typically these are written to a http.Request. */ type PcloudCloudinstancesGetParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -72,6 +70,21 @@ type PcloudCloudinstancesGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud cloudinstances get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesGetParams) WithDefaults() *PcloudCloudinstancesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud cloudinstances get params func (o *PcloudCloudinstancesGetParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesGetParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_instances/pcloud_cloudinstances_get_responses.go b/power/client/p_cloud_instances/pcloud_cloudinstances_get_responses.go index c2e7517d..c7056df6 100644 --- a/power/client/p_cloud_instances/pcloud_cloudinstances_get_responses.go +++ b/power/client/p_cloud_instances/pcloud_cloudinstances_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudCloudinstancesGetReader is a Reader for the PcloudCloudinstancesGet structure. @@ -24,44 +23,38 @@ type PcloudCloudinstancesGetReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudCloudinstancesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudCloudinstancesGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudCloudinstancesGetBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudCloudinstancesGetUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudCloudinstancesGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudCloudinstancesGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudCloudinstancesGetOK() *PcloudCloudinstancesGetOK { return &PcloudCloudinstancesGetOK{} } -/*PcloudCloudinstancesGetOK handles this case with default header values. +/* PcloudCloudinstancesGetOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudCloudinstancesGetOK struct { func (o *PcloudCloudinstancesGetOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}][%d] pcloudCloudinstancesGetOK %+v", 200, o.Payload) } +func (o *PcloudCloudinstancesGetOK) GetPayload() *models.CloudInstance { + return o.Payload +} func (o *PcloudCloudinstancesGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudCloudinstancesGetBadRequest() *PcloudCloudinstancesGetBadRequest { return &PcloudCloudinstancesGetBadRequest{} } -/*PcloudCloudinstancesGetBadRequest handles this case with default header values. +/* PcloudCloudinstancesGetBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudCloudinstancesGetBadRequest struct { func (o *PcloudCloudinstancesGetBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}][%d] pcloudCloudinstancesGetBadRequest %+v", 400, o.Payload) } +func (o *PcloudCloudinstancesGetBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudCloudinstancesGetUnauthorized() *PcloudCloudinstancesGetUnauthoriz return &PcloudCloudinstancesGetUnauthorized{} } -/*PcloudCloudinstancesGetUnauthorized handles this case with default header values. +/* PcloudCloudinstancesGetUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudCloudinstancesGetUnauthorized struct { func (o *PcloudCloudinstancesGetUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}][%d] pcloudCloudinstancesGetUnauthorized %+v", 401, o.Payload) } +func (o *PcloudCloudinstancesGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudCloudinstancesGetNotFound() *PcloudCloudinstancesGetNotFound { return &PcloudCloudinstancesGetNotFound{} } -/*PcloudCloudinstancesGetNotFound handles this case with default header values. +/* PcloudCloudinstancesGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -168,6 +170,9 @@ type PcloudCloudinstancesGetNotFound struct { func (o *PcloudCloudinstancesGetNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}][%d] pcloudCloudinstancesGetNotFound %+v", 404, o.Payload) } +func (o *PcloudCloudinstancesGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudCloudinstancesGetInternalServerError() *PcloudCloudinstancesGetInt return &PcloudCloudinstancesGetInternalServerError{} } -/*PcloudCloudinstancesGetInternalServerError handles this case with default header values. +/* PcloudCloudinstancesGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudCloudinstancesGetInternalServerError struct { func (o *PcloudCloudinstancesGetInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}][%d] pcloudCloudinstancesGetInternalServerError %+v", 500, o.Payload) } +func (o *PcloudCloudinstancesGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_instances/pcloud_cloudinstances_put_parameters.go b/power/client/p_cloud_instances/pcloud_cloudinstances_put_parameters.go index 04a998b4..4e47d1af 100644 --- a/power/client/p_cloud_instances/pcloud_cloudinstances_put_parameters.go +++ b/power/client/p_cloud_instances/pcloud_cloudinstances_put_parameters.go @@ -13,64 +13,63 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudCloudinstancesPutParams creates a new PcloudCloudinstancesPutParams object -// with the default values initialized. +// NewPcloudCloudinstancesPutParams creates a new PcloudCloudinstancesPutParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudCloudinstancesPutParams() *PcloudCloudinstancesPutParams { - var () return &PcloudCloudinstancesPutParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudCloudinstancesPutParamsWithTimeout creates a new PcloudCloudinstancesPutParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudCloudinstancesPutParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesPutParams { - var () return &PcloudCloudinstancesPutParams{ - timeout: timeout, } } // NewPcloudCloudinstancesPutParamsWithContext creates a new PcloudCloudinstancesPutParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudCloudinstancesPutParamsWithContext(ctx context.Context) *PcloudCloudinstancesPutParams { - var () return &PcloudCloudinstancesPutParams{ - Context: ctx, } } // NewPcloudCloudinstancesPutParamsWithHTTPClient creates a new PcloudCloudinstancesPutParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudCloudinstancesPutParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesPutParams { - var () return &PcloudCloudinstancesPutParams{ HTTPClient: client, } } -/*PcloudCloudinstancesPutParams contains all the parameters to send to the API endpoint -for the pcloud cloudinstances put operation typically these are written to a http.Request +/* PcloudCloudinstancesPutParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances put operation. + + Typically these are written to a http.Request. */ type PcloudCloudinstancesPutParams struct { - /*Body - Parameters for updating a Power Cloud Instance + /* Body. + Parameters for updating a Power Cloud Instance */ Body *models.CloudInstanceUpdate - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -79,6 +78,21 @@ type PcloudCloudinstancesPutParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud cloudinstances put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesPutParams) WithDefaults() *PcloudCloudinstancesPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesPutParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud cloudinstances put params func (o *PcloudCloudinstancesPutParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesPutParams { o.SetTimeout(timeout) @@ -141,7 +155,6 @@ func (o *PcloudCloudinstancesPutParams) WriteToRequest(r runtime.ClientRequest, return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_instances/pcloud_cloudinstances_put_responses.go b/power/client/p_cloud_instances/pcloud_cloudinstances_put_responses.go index 8e7cdbc3..8d6cf4b5 100644 --- a/power/client/p_cloud_instances/pcloud_cloudinstances_put_responses.go +++ b/power/client/p_cloud_instances/pcloud_cloudinstances_put_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudCloudinstancesPutReader is a Reader for the PcloudCloudinstancesPut structure. @@ -24,44 +23,38 @@ type PcloudCloudinstancesPutReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudCloudinstancesPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudCloudinstancesPutOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudCloudinstancesPutBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudCloudinstancesPutUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudCloudinstancesPutUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudCloudinstancesPutInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudCloudinstancesPutOK() *PcloudCloudinstancesPutOK { return &PcloudCloudinstancesPutOK{} } -/*PcloudCloudinstancesPutOK handles this case with default header values. +/* PcloudCloudinstancesPutOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudCloudinstancesPutOK struct { func (o *PcloudCloudinstancesPutOK) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}][%d] pcloudCloudinstancesPutOK %+v", 200, o.Payload) } +func (o *PcloudCloudinstancesPutOK) GetPayload() *models.CloudInstance { + return o.Payload +} func (o *PcloudCloudinstancesPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudCloudinstancesPutBadRequest() *PcloudCloudinstancesPutBadRequest { return &PcloudCloudinstancesPutBadRequest{} } -/*PcloudCloudinstancesPutBadRequest handles this case with default header values. +/* PcloudCloudinstancesPutBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudCloudinstancesPutBadRequest struct { func (o *PcloudCloudinstancesPutBadRequest) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}][%d] pcloudCloudinstancesPutBadRequest %+v", 400, o.Payload) } +func (o *PcloudCloudinstancesPutBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesPutBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudCloudinstancesPutUnauthorized() *PcloudCloudinstancesPutUnauthoriz return &PcloudCloudinstancesPutUnauthorized{} } -/*PcloudCloudinstancesPutUnauthorized handles this case with default header values. +/* PcloudCloudinstancesPutUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudCloudinstancesPutUnauthorized struct { func (o *PcloudCloudinstancesPutUnauthorized) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}][%d] pcloudCloudinstancesPutUnauthorized %+v", 401, o.Payload) } +func (o *PcloudCloudinstancesPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesPutUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudCloudinstancesPutUnprocessableEntity() *PcloudCloudinstancesPutUnp return &PcloudCloudinstancesPutUnprocessableEntity{} } -/*PcloudCloudinstancesPutUnprocessableEntity handles this case with default header values. +/* PcloudCloudinstancesPutUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -168,6 +170,9 @@ type PcloudCloudinstancesPutUnprocessableEntity struct { func (o *PcloudCloudinstancesPutUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}][%d] pcloudCloudinstancesPutUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudCloudinstancesPutUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesPutUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudCloudinstancesPutInternalServerError() *PcloudCloudinstancesPutInt return &PcloudCloudinstancesPutInternalServerError{} } -/*PcloudCloudinstancesPutInternalServerError handles this case with default header values. +/* PcloudCloudinstancesPutInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudCloudinstancesPutInternalServerError struct { func (o *PcloudCloudinstancesPutInternalServerError) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}][%d] pcloudCloudinstancesPutInternalServerError %+v", 500, o.Payload) } +func (o *PcloudCloudinstancesPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesPutInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_jobs/p_cloud_jobs_client.go b/power/client/p_cloud_jobs/p_cloud_jobs_client.go index 905abf68..0d4c362a 100644 --- a/power/client/p_cloud_jobs/p_cloud_jobs_client.go +++ b/power/client/p_cloud_jobs/p_cloud_jobs_client.go @@ -6,13 +6,14 @@ package p_cloud_jobs // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/runtime" + "fmt" - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" ) // New creates a new p cloud jobs API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { return &Client{transport: transport, formats: formats} } @@ -24,16 +25,29 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudCloudinstancesJobsDelete(params *PcloudCloudinstancesJobsDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesJobsDeleteOK, error) + + PcloudCloudinstancesJobsGet(params *PcloudCloudinstancesJobsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesJobsGetOK, error) + + PcloudCloudinstancesJobsGetall(params *PcloudCloudinstancesJobsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesJobsGetallOK, error) + + SetTransport(transport runtime.ClientTransport) +} + /* -PcloudCloudinstancesJobsDelete deletes a cloud instance job + PcloudCloudinstancesJobsDelete deletes a cloud instance job */ -func (a *Client) PcloudCloudinstancesJobsDelete(params *PcloudCloudinstancesJobsDeleteParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudCloudinstancesJobsDeleteOK, error) { +func (a *Client) PcloudCloudinstancesJobsDelete(params *PcloudCloudinstancesJobsDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesJobsDeleteOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudCloudinstancesJobsDeleteParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.cloudinstances.jobs.delete", Method: "DELETE", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/jobs/{job_id}", @@ -45,24 +59,34 @@ func (a *Client) PcloudCloudinstancesJobsDelete(params *PcloudCloudinstancesJobs AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudCloudinstancesJobsDeleteOK), nil - + success, ok := result.(*PcloudCloudinstancesJobsDeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.cloudinstances.jobs.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudCloudinstancesJobsGet lists the detail of a job + PcloudCloudinstancesJobsGet lists the detail of a job */ -func (a *Client) PcloudCloudinstancesJobsGet(params *PcloudCloudinstancesJobsGetParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudCloudinstancesJobsGetOK, error) { +func (a *Client) PcloudCloudinstancesJobsGet(params *PcloudCloudinstancesJobsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesJobsGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudCloudinstancesJobsGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.cloudinstances.jobs.get", Method: "GET", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/jobs/{job_id}", @@ -74,24 +98,34 @@ func (a *Client) PcloudCloudinstancesJobsGet(params *PcloudCloudinstancesJobsGet AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudCloudinstancesJobsGetOK), nil - + success, ok := result.(*PcloudCloudinstancesJobsGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.cloudinstances.jobs.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudCloudinstancesJobsGetall lists up to the last 5 jobs initiated by the cloud instance + PcloudCloudinstancesJobsGetall lists up to the last 5 jobs initiated by the cloud instance */ -func (a *Client) PcloudCloudinstancesJobsGetall(params *PcloudCloudinstancesJobsGetallParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudCloudinstancesJobsGetallOK, error) { +func (a *Client) PcloudCloudinstancesJobsGetall(params *PcloudCloudinstancesJobsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesJobsGetallOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudCloudinstancesJobsGetallParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.cloudinstances.jobs.getall", Method: "GET", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/jobs", @@ -103,12 +137,23 @@ func (a *Client) PcloudCloudinstancesJobsGetall(params *PcloudCloudinstancesJobs AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudCloudinstancesJobsGetallOK), nil - + success, ok := result.(*PcloudCloudinstancesJobsGetallOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.cloudinstances.jobs.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } // SetTransport changes the transport on the client diff --git a/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_delete_parameters.go b/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_delete_parameters.go index 7468f715..9e3b31e1 100644 --- a/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_delete_parameters.go +++ b/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_delete_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudCloudinstancesJobsDeleteParams creates a new PcloudCloudinstancesJobsDeleteParams object -// with the default values initialized. +// NewPcloudCloudinstancesJobsDeleteParams creates a new PcloudCloudinstancesJobsDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudCloudinstancesJobsDeleteParams() *PcloudCloudinstancesJobsDeleteParams { - var () return &PcloudCloudinstancesJobsDeleteParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudCloudinstancesJobsDeleteParamsWithTimeout creates a new PcloudCloudinstancesJobsDeleteParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudCloudinstancesJobsDeleteParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesJobsDeleteParams { - var () return &PcloudCloudinstancesJobsDeleteParams{ - timeout: timeout, } } // NewPcloudCloudinstancesJobsDeleteParamsWithContext creates a new PcloudCloudinstancesJobsDeleteParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudCloudinstancesJobsDeleteParamsWithContext(ctx context.Context) *PcloudCloudinstancesJobsDeleteParams { - var () return &PcloudCloudinstancesJobsDeleteParams{ - Context: ctx, } } // NewPcloudCloudinstancesJobsDeleteParamsWithHTTPClient creates a new PcloudCloudinstancesJobsDeleteParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudCloudinstancesJobsDeleteParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesJobsDeleteParams { - var () return &PcloudCloudinstancesJobsDeleteParams{ HTTPClient: client, } } -/*PcloudCloudinstancesJobsDeleteParams contains all the parameters to send to the API endpoint -for the pcloud cloudinstances jobs delete operation typically these are written to a http.Request +/* PcloudCloudinstancesJobsDeleteParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances jobs delete operation. + + Typically these are written to a http.Request. */ type PcloudCloudinstancesJobsDeleteParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*JobID - PCloud Job ID + /* JobID. + + PCloud Job ID */ JobID string @@ -77,6 +76,21 @@ type PcloudCloudinstancesJobsDeleteParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud cloudinstances jobs delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesJobsDeleteParams) WithDefaults() *PcloudCloudinstancesJobsDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances jobs delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesJobsDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud cloudinstances jobs delete params func (o *PcloudCloudinstancesJobsDeleteParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesJobsDeleteParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_delete_responses.go b/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_delete_responses.go index bdc27460..da6ffd99 100644 --- a/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_delete_responses.go +++ b/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_delete_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudCloudinstancesJobsDeleteReader is a Reader for the PcloudCloudinstancesJobsDelete structure. @@ -24,51 +23,44 @@ type PcloudCloudinstancesJobsDeleteReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudCloudinstancesJobsDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudCloudinstancesJobsDeleteOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudCloudinstancesJobsDeleteBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudCloudinstancesJobsDeleteUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudCloudinstancesJobsDeleteNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 409: result := NewPcloudCloudinstancesJobsDeleteConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudCloudinstancesJobsDeleteInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -77,7 +69,7 @@ func NewPcloudCloudinstancesJobsDeleteOK() *PcloudCloudinstancesJobsDeleteOK { return &PcloudCloudinstancesJobsDeleteOK{} } -/*PcloudCloudinstancesJobsDeleteOK handles this case with default header values. +/* PcloudCloudinstancesJobsDeleteOK describes a response with status code 200, with default header values. OK */ @@ -88,6 +80,9 @@ type PcloudCloudinstancesJobsDeleteOK struct { func (o *PcloudCloudinstancesJobsDeleteOK) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/jobs/{job_id}][%d] pcloudCloudinstancesJobsDeleteOK %+v", 200, o.Payload) } +func (o *PcloudCloudinstancesJobsDeleteOK) GetPayload() models.Object { + return o.Payload +} func (o *PcloudCloudinstancesJobsDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -104,7 +99,7 @@ func NewPcloudCloudinstancesJobsDeleteBadRequest() *PcloudCloudinstancesJobsDele return &PcloudCloudinstancesJobsDeleteBadRequest{} } -/*PcloudCloudinstancesJobsDeleteBadRequest handles this case with default header values. +/* PcloudCloudinstancesJobsDeleteBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -115,6 +110,9 @@ type PcloudCloudinstancesJobsDeleteBadRequest struct { func (o *PcloudCloudinstancesJobsDeleteBadRequest) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/jobs/{job_id}][%d] pcloudCloudinstancesJobsDeleteBadRequest %+v", 400, o.Payload) } +func (o *PcloudCloudinstancesJobsDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesJobsDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -133,7 +131,7 @@ func NewPcloudCloudinstancesJobsDeleteUnauthorized() *PcloudCloudinstancesJobsDe return &PcloudCloudinstancesJobsDeleteUnauthorized{} } -/*PcloudCloudinstancesJobsDeleteUnauthorized handles this case with default header values. +/* PcloudCloudinstancesJobsDeleteUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -144,6 +142,9 @@ type PcloudCloudinstancesJobsDeleteUnauthorized struct { func (o *PcloudCloudinstancesJobsDeleteUnauthorized) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/jobs/{job_id}][%d] pcloudCloudinstancesJobsDeleteUnauthorized %+v", 401, o.Payload) } +func (o *PcloudCloudinstancesJobsDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesJobsDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -162,7 +163,7 @@ func NewPcloudCloudinstancesJobsDeleteNotFound() *PcloudCloudinstancesJobsDelete return &PcloudCloudinstancesJobsDeleteNotFound{} } -/*PcloudCloudinstancesJobsDeleteNotFound handles this case with default header values. +/* PcloudCloudinstancesJobsDeleteNotFound describes a response with status code 404, with default header values. Not Found */ @@ -173,6 +174,9 @@ type PcloudCloudinstancesJobsDeleteNotFound struct { func (o *PcloudCloudinstancesJobsDeleteNotFound) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/jobs/{job_id}][%d] pcloudCloudinstancesJobsDeleteNotFound %+v", 404, o.Payload) } +func (o *PcloudCloudinstancesJobsDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesJobsDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -191,7 +195,7 @@ func NewPcloudCloudinstancesJobsDeleteConflict() *PcloudCloudinstancesJobsDelete return &PcloudCloudinstancesJobsDeleteConflict{} } -/*PcloudCloudinstancesJobsDeleteConflict handles this case with default header values. +/* PcloudCloudinstancesJobsDeleteConflict describes a response with status code 409, with default header values. Conflict */ @@ -202,6 +206,9 @@ type PcloudCloudinstancesJobsDeleteConflict struct { func (o *PcloudCloudinstancesJobsDeleteConflict) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/jobs/{job_id}][%d] pcloudCloudinstancesJobsDeleteConflict %+v", 409, o.Payload) } +func (o *PcloudCloudinstancesJobsDeleteConflict) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesJobsDeleteConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -220,7 +227,7 @@ func NewPcloudCloudinstancesJobsDeleteInternalServerError() *PcloudCloudinstance return &PcloudCloudinstancesJobsDeleteInternalServerError{} } -/*PcloudCloudinstancesJobsDeleteInternalServerError handles this case with default header values. +/* PcloudCloudinstancesJobsDeleteInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -231,6 +238,9 @@ type PcloudCloudinstancesJobsDeleteInternalServerError struct { func (o *PcloudCloudinstancesJobsDeleteInternalServerError) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/jobs/{job_id}][%d] pcloudCloudinstancesJobsDeleteInternalServerError %+v", 500, o.Payload) } +func (o *PcloudCloudinstancesJobsDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesJobsDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_get_parameters.go b/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_get_parameters.go index 68c7dd1b..8b584354 100644 --- a/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_get_parameters.go +++ b/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_get_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudCloudinstancesJobsGetParams creates a new PcloudCloudinstancesJobsGetParams object -// with the default values initialized. +// NewPcloudCloudinstancesJobsGetParams creates a new PcloudCloudinstancesJobsGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudCloudinstancesJobsGetParams() *PcloudCloudinstancesJobsGetParams { - var () return &PcloudCloudinstancesJobsGetParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudCloudinstancesJobsGetParamsWithTimeout creates a new PcloudCloudinstancesJobsGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudCloudinstancesJobsGetParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesJobsGetParams { - var () return &PcloudCloudinstancesJobsGetParams{ - timeout: timeout, } } // NewPcloudCloudinstancesJobsGetParamsWithContext creates a new PcloudCloudinstancesJobsGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudCloudinstancesJobsGetParamsWithContext(ctx context.Context) *PcloudCloudinstancesJobsGetParams { - var () return &PcloudCloudinstancesJobsGetParams{ - Context: ctx, } } // NewPcloudCloudinstancesJobsGetParamsWithHTTPClient creates a new PcloudCloudinstancesJobsGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudCloudinstancesJobsGetParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesJobsGetParams { - var () return &PcloudCloudinstancesJobsGetParams{ HTTPClient: client, } } -/*PcloudCloudinstancesJobsGetParams contains all the parameters to send to the API endpoint -for the pcloud cloudinstances jobs get operation typically these are written to a http.Request +/* PcloudCloudinstancesJobsGetParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances jobs get operation. + + Typically these are written to a http.Request. */ type PcloudCloudinstancesJobsGetParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*JobID - PCloud Job ID + /* JobID. + + PCloud Job ID */ JobID string @@ -77,6 +76,21 @@ type PcloudCloudinstancesJobsGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud cloudinstances jobs get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesJobsGetParams) WithDefaults() *PcloudCloudinstancesJobsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances jobs get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesJobsGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud cloudinstances jobs get params func (o *PcloudCloudinstancesJobsGetParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesJobsGetParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_get_responses.go b/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_get_responses.go index 0c844857..b232653f 100644 --- a/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_get_responses.go +++ b/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudCloudinstancesJobsGetReader is a Reader for the PcloudCloudinstancesJobsGet structure. @@ -24,44 +23,38 @@ type PcloudCloudinstancesJobsGetReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudCloudinstancesJobsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudCloudinstancesJobsGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudCloudinstancesJobsGetBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudCloudinstancesJobsGetUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudCloudinstancesJobsGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudCloudinstancesJobsGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudCloudinstancesJobsGetOK() *PcloudCloudinstancesJobsGetOK { return &PcloudCloudinstancesJobsGetOK{} } -/*PcloudCloudinstancesJobsGetOK handles this case with default header values. +/* PcloudCloudinstancesJobsGetOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudCloudinstancesJobsGetOK struct { func (o *PcloudCloudinstancesJobsGetOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/jobs/{job_id}][%d] pcloudCloudinstancesJobsGetOK %+v", 200, o.Payload) } +func (o *PcloudCloudinstancesJobsGetOK) GetPayload() *models.Job { + return o.Payload +} func (o *PcloudCloudinstancesJobsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudCloudinstancesJobsGetBadRequest() *PcloudCloudinstancesJobsGetBadR return &PcloudCloudinstancesJobsGetBadRequest{} } -/*PcloudCloudinstancesJobsGetBadRequest handles this case with default header values. +/* PcloudCloudinstancesJobsGetBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudCloudinstancesJobsGetBadRequest struct { func (o *PcloudCloudinstancesJobsGetBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/jobs/{job_id}][%d] pcloudCloudinstancesJobsGetBadRequest %+v", 400, o.Payload) } +func (o *PcloudCloudinstancesJobsGetBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesJobsGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudCloudinstancesJobsGetUnauthorized() *PcloudCloudinstancesJobsGetUn return &PcloudCloudinstancesJobsGetUnauthorized{} } -/*PcloudCloudinstancesJobsGetUnauthorized handles this case with default header values. +/* PcloudCloudinstancesJobsGetUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudCloudinstancesJobsGetUnauthorized struct { func (o *PcloudCloudinstancesJobsGetUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/jobs/{job_id}][%d] pcloudCloudinstancesJobsGetUnauthorized %+v", 401, o.Payload) } +func (o *PcloudCloudinstancesJobsGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesJobsGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudCloudinstancesJobsGetNotFound() *PcloudCloudinstancesJobsGetNotFou return &PcloudCloudinstancesJobsGetNotFound{} } -/*PcloudCloudinstancesJobsGetNotFound handles this case with default header values. +/* PcloudCloudinstancesJobsGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -168,6 +170,9 @@ type PcloudCloudinstancesJobsGetNotFound struct { func (o *PcloudCloudinstancesJobsGetNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/jobs/{job_id}][%d] pcloudCloudinstancesJobsGetNotFound %+v", 404, o.Payload) } +func (o *PcloudCloudinstancesJobsGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesJobsGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudCloudinstancesJobsGetInternalServerError() *PcloudCloudinstancesJo return &PcloudCloudinstancesJobsGetInternalServerError{} } -/*PcloudCloudinstancesJobsGetInternalServerError handles this case with default header values. +/* PcloudCloudinstancesJobsGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudCloudinstancesJobsGetInternalServerError struct { func (o *PcloudCloudinstancesJobsGetInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/jobs/{job_id}][%d] pcloudCloudinstancesJobsGetInternalServerError %+v", 500, o.Payload) } +func (o *PcloudCloudinstancesJobsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesJobsGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_getall_parameters.go b/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_getall_parameters.go index 6ed4d432..50646a09 100644 --- a/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_getall_parameters.go +++ b/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_getall_parameters.go @@ -13,72 +13,73 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudCloudinstancesJobsGetallParams creates a new PcloudCloudinstancesJobsGetallParams object -// with the default values initialized. +// NewPcloudCloudinstancesJobsGetallParams creates a new PcloudCloudinstancesJobsGetallParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudCloudinstancesJobsGetallParams() *PcloudCloudinstancesJobsGetallParams { - var () return &PcloudCloudinstancesJobsGetallParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudCloudinstancesJobsGetallParamsWithTimeout creates a new PcloudCloudinstancesJobsGetallParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudCloudinstancesJobsGetallParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesJobsGetallParams { - var () return &PcloudCloudinstancesJobsGetallParams{ - timeout: timeout, } } // NewPcloudCloudinstancesJobsGetallParamsWithContext creates a new PcloudCloudinstancesJobsGetallParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudCloudinstancesJobsGetallParamsWithContext(ctx context.Context) *PcloudCloudinstancesJobsGetallParams { - var () return &PcloudCloudinstancesJobsGetallParams{ - Context: ctx, } } // NewPcloudCloudinstancesJobsGetallParamsWithHTTPClient creates a new PcloudCloudinstancesJobsGetallParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudCloudinstancesJobsGetallParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesJobsGetallParams { - var () return &PcloudCloudinstancesJobsGetallParams{ HTTPClient: client, } } -/*PcloudCloudinstancesJobsGetallParams contains all the parameters to send to the API endpoint -for the pcloud cloudinstances jobs getall operation typically these are written to a http.Request +/* PcloudCloudinstancesJobsGetallParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances jobs getall operation. + + Typically these are written to a http.Request. */ type PcloudCloudinstancesJobsGetallParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*OperationAction - Operation action to filter jobs (optional) vmCapture - includes operation action value (vmCapture) imageExport - includes operation action value (imageExport) imageImport - includes operation action value (imageImport) storage - includes operation action values (vmCapture,imageExport,imageImport) + /* OperationAction. + + Operation action to filter jobs (optional) vmCapture - includes operation action value (vmCapture) imageExport - includes operation action value (imageExport) imageImport - includes operation action value (imageImport) storage - includes operation action values (vmCapture,imageExport,imageImport) */ OperationAction *string - /*OperationID - Operation ID to filter jobs (optional) + /* OperationID. + + Operation ID to filter jobs (optional) */ OperationID *string - /*OperationTarget - Operation target to filter jobs (optional) + /* OperationTarget. + + Operation target to filter jobs (optional) */ OperationTarget *string @@ -87,6 +88,21 @@ type PcloudCloudinstancesJobsGetallParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud cloudinstances jobs getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesJobsGetallParams) WithDefaults() *PcloudCloudinstancesJobsGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances jobs getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesJobsGetallParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud cloudinstances jobs getall params func (o *PcloudCloudinstancesJobsGetallParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesJobsGetallParams { o.SetTimeout(timeout) @@ -181,48 +197,51 @@ func (o *PcloudCloudinstancesJobsGetallParams) WriteToRequest(r runtime.ClientRe // query param operation.action var qrOperationAction string + if o.OperationAction != nil { qrOperationAction = *o.OperationAction } qOperationAction := qrOperationAction if qOperationAction != "" { + if err := r.SetQueryParam("operation.action", qOperationAction); err != nil { return err } } - } if o.OperationID != nil { // query param operation.id var qrOperationID string + if o.OperationID != nil { qrOperationID = *o.OperationID } qOperationID := qrOperationID if qOperationID != "" { + if err := r.SetQueryParam("operation.id", qOperationID); err != nil { return err } } - } if o.OperationTarget != nil { // query param operation.target var qrOperationTarget string + if o.OperationTarget != nil { qrOperationTarget = *o.OperationTarget } qOperationTarget := qrOperationTarget if qOperationTarget != "" { + if err := r.SetQueryParam("operation.target", qOperationTarget); err != nil { return err } } - } if len(res) > 0 { diff --git a/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_getall_responses.go b/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_getall_responses.go index a73cfdf7..d3b942e5 100644 --- a/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_getall_responses.go +++ b/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_getall_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudCloudinstancesJobsGetallReader is a Reader for the PcloudCloudinstancesJobsGetall structure. @@ -24,44 +23,38 @@ type PcloudCloudinstancesJobsGetallReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudCloudinstancesJobsGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudCloudinstancesJobsGetallOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudCloudinstancesJobsGetallBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudCloudinstancesJobsGetallUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudCloudinstancesJobsGetallNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudCloudinstancesJobsGetallInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudCloudinstancesJobsGetallOK() *PcloudCloudinstancesJobsGetallOK { return &PcloudCloudinstancesJobsGetallOK{} } -/*PcloudCloudinstancesJobsGetallOK handles this case with default header values. +/* PcloudCloudinstancesJobsGetallOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudCloudinstancesJobsGetallOK struct { func (o *PcloudCloudinstancesJobsGetallOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/jobs][%d] pcloudCloudinstancesJobsGetallOK %+v", 200, o.Payload) } +func (o *PcloudCloudinstancesJobsGetallOK) GetPayload() *models.Jobs { + return o.Payload +} func (o *PcloudCloudinstancesJobsGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudCloudinstancesJobsGetallBadRequest() *PcloudCloudinstancesJobsGeta return &PcloudCloudinstancesJobsGetallBadRequest{} } -/*PcloudCloudinstancesJobsGetallBadRequest handles this case with default header values. +/* PcloudCloudinstancesJobsGetallBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudCloudinstancesJobsGetallBadRequest struct { func (o *PcloudCloudinstancesJobsGetallBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/jobs][%d] pcloudCloudinstancesJobsGetallBadRequest %+v", 400, o.Payload) } +func (o *PcloudCloudinstancesJobsGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesJobsGetallBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudCloudinstancesJobsGetallUnauthorized() *PcloudCloudinstancesJobsGe return &PcloudCloudinstancesJobsGetallUnauthorized{} } -/*PcloudCloudinstancesJobsGetallUnauthorized handles this case with default header values. +/* PcloudCloudinstancesJobsGetallUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudCloudinstancesJobsGetallUnauthorized struct { func (o *PcloudCloudinstancesJobsGetallUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/jobs][%d] pcloudCloudinstancesJobsGetallUnauthorized %+v", 401, o.Payload) } +func (o *PcloudCloudinstancesJobsGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesJobsGetallUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudCloudinstancesJobsGetallNotFound() *PcloudCloudinstancesJobsGetall return &PcloudCloudinstancesJobsGetallNotFound{} } -/*PcloudCloudinstancesJobsGetallNotFound handles this case with default header values. +/* PcloudCloudinstancesJobsGetallNotFound describes a response with status code 404, with default header values. Not Found */ @@ -168,6 +170,9 @@ type PcloudCloudinstancesJobsGetallNotFound struct { func (o *PcloudCloudinstancesJobsGetallNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/jobs][%d] pcloudCloudinstancesJobsGetallNotFound %+v", 404, o.Payload) } +func (o *PcloudCloudinstancesJobsGetallNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesJobsGetallNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudCloudinstancesJobsGetallInternalServerError() *PcloudCloudinstance return &PcloudCloudinstancesJobsGetallInternalServerError{} } -/*PcloudCloudinstancesJobsGetallInternalServerError handles this case with default header values. +/* PcloudCloudinstancesJobsGetallInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudCloudinstancesJobsGetallInternalServerError struct { func (o *PcloudCloudinstancesJobsGetallInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/jobs][%d] pcloudCloudinstancesJobsGetallInternalServerError %+v", 500, o.Payload) } +func (o *PcloudCloudinstancesJobsGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesJobsGetallInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_networks/p_cloud_networks_client.go b/power/client/p_cloud_networks/p_cloud_networks_client.go index a264c421..5a08ce2c 100644 --- a/power/client/p_cloud_networks/p_cloud_networks_client.go +++ b/power/client/p_cloud_networks/p_cloud_networks_client.go @@ -6,13 +6,14 @@ package p_cloud_networks // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/runtime" + "fmt" - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" ) // New creates a new p cloud networks API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { return &Client{transport: transport, formats: formats} } @@ -24,16 +25,43 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudNetworksDelete(params *PcloudNetworksDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksDeleteOK, error) + + PcloudNetworksGet(params *PcloudNetworksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksGetOK, error) + + PcloudNetworksGetall(params *PcloudNetworksGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksGetallOK, error) + + PcloudNetworksPortsDelete(params *PcloudNetworksPortsDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksPortsDeleteOK, error) + + PcloudNetworksPortsGet(params *PcloudNetworksPortsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksPortsGetOK, error) + + PcloudNetworksPortsGetall(params *PcloudNetworksPortsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksPortsGetallOK, error) + + PcloudNetworksPortsPost(params *PcloudNetworksPortsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksPortsPostCreated, error) + + PcloudNetworksPortsPut(params *PcloudNetworksPortsPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksPortsPutOK, error) + + PcloudNetworksPost(params *PcloudNetworksPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksPostOK, *PcloudNetworksPostCreated, error) + + PcloudNetworksPut(params *PcloudNetworksPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksPutOK, error) + + SetTransport(transport runtime.ClientTransport) +} + /* -PcloudNetworksDelete deletes a network + PcloudNetworksDelete deletes a network */ -func (a *Client) PcloudNetworksDelete(params *PcloudNetworksDeleteParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudNetworksDeleteOK, error) { +func (a *Client) PcloudNetworksDelete(params *PcloudNetworksDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksDeleteOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudNetworksDeleteParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.networks.delete", Method: "DELETE", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}", @@ -45,24 +73,34 @@ func (a *Client) PcloudNetworksDelete(params *PcloudNetworksDeleteParams, authIn AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudNetworksDeleteOK), nil - + success, ok := result.(*PcloudNetworksDeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.networks.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudNetworksGet gets a network s current state information + PcloudNetworksGet gets a network s current state information */ -func (a *Client) PcloudNetworksGet(params *PcloudNetworksGetParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudNetworksGetOK, error) { +func (a *Client) PcloudNetworksGet(params *PcloudNetworksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudNetworksGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.networks.get", Method: "GET", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}", @@ -74,24 +112,34 @@ func (a *Client) PcloudNetworksGet(params *PcloudNetworksGetParams, authInfo run AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudNetworksGetOK), nil - + success, ok := result.(*PcloudNetworksGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.networks.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudNetworksGetall gets all networks in this cloud instance + PcloudNetworksGetall gets all networks in this cloud instance */ -func (a *Client) PcloudNetworksGetall(params *PcloudNetworksGetallParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudNetworksGetallOK, error) { +func (a *Client) PcloudNetworksGetall(params *PcloudNetworksGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksGetallOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudNetworksGetallParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.networks.getall", Method: "GET", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/networks", @@ -103,24 +151,34 @@ func (a *Client) PcloudNetworksGetall(params *PcloudNetworksGetallParams, authIn AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudNetworksGetallOK), nil - + success, ok := result.(*PcloudNetworksGetallOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.networks.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudNetworksPortsDelete deletes a network port + PcloudNetworksPortsDelete deletes a network port */ -func (a *Client) PcloudNetworksPortsDelete(params *PcloudNetworksPortsDeleteParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudNetworksPortsDeleteOK, error) { +func (a *Client) PcloudNetworksPortsDelete(params *PcloudNetworksPortsDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksPortsDeleteOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudNetworksPortsDeleteParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.networks.ports.delete", Method: "DELETE", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}", @@ -132,24 +190,34 @@ func (a *Client) PcloudNetworksPortsDelete(params *PcloudNetworksPortsDeletePara AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudNetworksPortsDeleteOK), nil - + success, ok := result.(*PcloudNetworksPortsDeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.networks.ports.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudNetworksPortsGet gets a port s information + PcloudNetworksPortsGet gets a port s information */ -func (a *Client) PcloudNetworksPortsGet(params *PcloudNetworksPortsGetParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudNetworksPortsGetOK, error) { +func (a *Client) PcloudNetworksPortsGet(params *PcloudNetworksPortsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksPortsGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudNetworksPortsGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.networks.ports.get", Method: "GET", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}", @@ -161,24 +229,34 @@ func (a *Client) PcloudNetworksPortsGet(params *PcloudNetworksPortsGetParams, au AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudNetworksPortsGetOK), nil - + success, ok := result.(*PcloudNetworksPortsGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.networks.ports.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudNetworksPortsGetall gets all ports for this network + PcloudNetworksPortsGetall gets all ports for this network */ -func (a *Client) PcloudNetworksPortsGetall(params *PcloudNetworksPortsGetallParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudNetworksPortsGetallOK, error) { +func (a *Client) PcloudNetworksPortsGetall(params *PcloudNetworksPortsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksPortsGetallOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudNetworksPortsGetallParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.networks.ports.getall", Method: "GET", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports", @@ -190,24 +268,34 @@ func (a *Client) PcloudNetworksPortsGetall(params *PcloudNetworksPortsGetallPara AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudNetworksPortsGetallOK), nil - + success, ok := result.(*PcloudNetworksPortsGetallOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.networks.ports.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudNetworksPortsPost performs port addition deletion and listing + PcloudNetworksPortsPost performs port addition deletion and listing */ -func (a *Client) PcloudNetworksPortsPost(params *PcloudNetworksPortsPostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudNetworksPortsPostCreated, error) { +func (a *Client) PcloudNetworksPortsPost(params *PcloudNetworksPortsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksPortsPostCreated, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudNetworksPortsPostParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.networks.ports.post", Method: "POST", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports", @@ -219,24 +307,34 @@ func (a *Client) PcloudNetworksPortsPost(params *PcloudNetworksPortsPostParams, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudNetworksPortsPostCreated), nil - + success, ok := result.(*PcloudNetworksPortsPostCreated) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.networks.ports.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudNetworksPortsPut updates a port s information + PcloudNetworksPortsPut updates a port s information */ -func (a *Client) PcloudNetworksPortsPut(params *PcloudNetworksPortsPutParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudNetworksPortsPutOK, error) { +func (a *Client) PcloudNetworksPortsPut(params *PcloudNetworksPortsPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksPortsPutOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudNetworksPortsPutParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.networks.ports.put", Method: "PUT", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}", @@ -248,24 +346,34 @@ func (a *Client) PcloudNetworksPortsPut(params *PcloudNetworksPortsPutParams, au AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudNetworksPortsPutOK), nil - + success, ok := result.(*PcloudNetworksPortsPutOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.networks.ports.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudNetworksPost creates a new network + PcloudNetworksPost creates a new network */ -func (a *Client) PcloudNetworksPost(params *PcloudNetworksPostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudNetworksPostOK, *PcloudNetworksPostCreated, error) { +func (a *Client) PcloudNetworksPost(params *PcloudNetworksPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksPostOK, *PcloudNetworksPostCreated, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudNetworksPostParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.networks.post", Method: "POST", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/networks", @@ -277,7 +385,12 @@ func (a *Client) PcloudNetworksPost(params *PcloudNetworksPostParams, authInfo r AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, nil, err } @@ -287,20 +400,20 @@ func (a *Client) PcloudNetworksPost(params *PcloudNetworksPostParams, authInfo r case *PcloudNetworksPostCreated: return nil, value, nil } - return nil, nil, nil - + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for p_cloud_networks: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudNetworksPut updates a network + PcloudNetworksPut updates a network */ -func (a *Client) PcloudNetworksPut(params *PcloudNetworksPutParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudNetworksPutOK, error) { +func (a *Client) PcloudNetworksPut(params *PcloudNetworksPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksPutOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudNetworksPutParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.networks.put", Method: "PUT", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}", @@ -312,12 +425,23 @@ func (a *Client) PcloudNetworksPut(params *PcloudNetworksPutParams, authInfo run AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudNetworksPutOK), nil - + success, ok := result.(*PcloudNetworksPutOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.networks.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } // SetTransport changes the transport on the client diff --git a/power/client/p_cloud_networks/pcloud_networks_delete_parameters.go b/power/client/p_cloud_networks/pcloud_networks_delete_parameters.go index c823a427..ed9fd5e8 100644 --- a/power/client/p_cloud_networks/pcloud_networks_delete_parameters.go +++ b/power/client/p_cloud_networks/pcloud_networks_delete_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudNetworksDeleteParams creates a new PcloudNetworksDeleteParams object -// with the default values initialized. +// NewPcloudNetworksDeleteParams creates a new PcloudNetworksDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudNetworksDeleteParams() *PcloudNetworksDeleteParams { - var () return &PcloudNetworksDeleteParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudNetworksDeleteParamsWithTimeout creates a new PcloudNetworksDeleteParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudNetworksDeleteParamsWithTimeout(timeout time.Duration) *PcloudNetworksDeleteParams { - var () return &PcloudNetworksDeleteParams{ - timeout: timeout, } } // NewPcloudNetworksDeleteParamsWithContext creates a new PcloudNetworksDeleteParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudNetworksDeleteParamsWithContext(ctx context.Context) *PcloudNetworksDeleteParams { - var () return &PcloudNetworksDeleteParams{ - Context: ctx, } } // NewPcloudNetworksDeleteParamsWithHTTPClient creates a new PcloudNetworksDeleteParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudNetworksDeleteParamsWithHTTPClient(client *http.Client) *PcloudNetworksDeleteParams { - var () return &PcloudNetworksDeleteParams{ HTTPClient: client, } } -/*PcloudNetworksDeleteParams contains all the parameters to send to the API endpoint -for the pcloud networks delete operation typically these are written to a http.Request +/* PcloudNetworksDeleteParams contains all the parameters to send to the API endpoint + for the pcloud networks delete operation. + + Typically these are written to a http.Request. */ type PcloudNetworksDeleteParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*NetworkID - Network ID + /* NetworkID. + + Network ID */ NetworkID string @@ -77,6 +76,21 @@ type PcloudNetworksDeleteParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud networks delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksDeleteParams) WithDefaults() *PcloudNetworksDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud networks delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud networks delete params func (o *PcloudNetworksDeleteParams) WithTimeout(timeout time.Duration) *PcloudNetworksDeleteParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_networks/pcloud_networks_delete_responses.go b/power/client/p_cloud_networks/pcloud_networks_delete_responses.go index 75172ea3..67dba952 100644 --- a/power/client/p_cloud_networks/pcloud_networks_delete_responses.go +++ b/power/client/p_cloud_networks/pcloud_networks_delete_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudNetworksDeleteReader is a Reader for the PcloudNetworksDelete structure. @@ -24,44 +23,38 @@ type PcloudNetworksDeleteReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudNetworksDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudNetworksDeleteOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudNetworksDeleteBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudNetworksDeleteUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 410: result := NewPcloudNetworksDeleteGone() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudNetworksDeleteInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudNetworksDeleteOK() *PcloudNetworksDeleteOK { return &PcloudNetworksDeleteOK{} } -/*PcloudNetworksDeleteOK handles this case with default header values. +/* PcloudNetworksDeleteOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudNetworksDeleteOK struct { func (o *PcloudNetworksDeleteOK) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}][%d] pcloudNetworksDeleteOK %+v", 200, o.Payload) } +func (o *PcloudNetworksDeleteOK) GetPayload() models.Object { + return o.Payload +} func (o *PcloudNetworksDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -97,7 +93,7 @@ func NewPcloudNetworksDeleteBadRequest() *PcloudNetworksDeleteBadRequest { return &PcloudNetworksDeleteBadRequest{} } -/*PcloudNetworksDeleteBadRequest handles this case with default header values. +/* PcloudNetworksDeleteBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -108,6 +104,9 @@ type PcloudNetworksDeleteBadRequest struct { func (o *PcloudNetworksDeleteBadRequest) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}][%d] pcloudNetworksDeleteBadRequest %+v", 400, o.Payload) } +func (o *PcloudNetworksDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -126,7 +125,7 @@ func NewPcloudNetworksDeleteUnauthorized() *PcloudNetworksDeleteUnauthorized { return &PcloudNetworksDeleteUnauthorized{} } -/*PcloudNetworksDeleteUnauthorized handles this case with default header values. +/* PcloudNetworksDeleteUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -137,6 +136,9 @@ type PcloudNetworksDeleteUnauthorized struct { func (o *PcloudNetworksDeleteUnauthorized) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}][%d] pcloudNetworksDeleteUnauthorized %+v", 401, o.Payload) } +func (o *PcloudNetworksDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -155,7 +157,7 @@ func NewPcloudNetworksDeleteGone() *PcloudNetworksDeleteGone { return &PcloudNetworksDeleteGone{} } -/*PcloudNetworksDeleteGone handles this case with default header values. +/* PcloudNetworksDeleteGone describes a response with status code 410, with default header values. Gone */ @@ -166,6 +168,9 @@ type PcloudNetworksDeleteGone struct { func (o *PcloudNetworksDeleteGone) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}][%d] pcloudNetworksDeleteGone %+v", 410, o.Payload) } +func (o *PcloudNetworksDeleteGone) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksDeleteGone) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -184,7 +189,7 @@ func NewPcloudNetworksDeleteInternalServerError() *PcloudNetworksDeleteInternalS return &PcloudNetworksDeleteInternalServerError{} } -/*PcloudNetworksDeleteInternalServerError handles this case with default header values. +/* PcloudNetworksDeleteInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -195,6 +200,9 @@ type PcloudNetworksDeleteInternalServerError struct { func (o *PcloudNetworksDeleteInternalServerError) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}][%d] pcloudNetworksDeleteInternalServerError %+v", 500, o.Payload) } +func (o *PcloudNetworksDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_networks/pcloud_networks_get_parameters.go b/power/client/p_cloud_networks/pcloud_networks_get_parameters.go index ff533609..a9694c89 100644 --- a/power/client/p_cloud_networks/pcloud_networks_get_parameters.go +++ b/power/client/p_cloud_networks/pcloud_networks_get_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudNetworksGetParams creates a new PcloudNetworksGetParams object -// with the default values initialized. +// NewPcloudNetworksGetParams creates a new PcloudNetworksGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudNetworksGetParams() *PcloudNetworksGetParams { - var () return &PcloudNetworksGetParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudNetworksGetParamsWithTimeout creates a new PcloudNetworksGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudNetworksGetParamsWithTimeout(timeout time.Duration) *PcloudNetworksGetParams { - var () return &PcloudNetworksGetParams{ - timeout: timeout, } } // NewPcloudNetworksGetParamsWithContext creates a new PcloudNetworksGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudNetworksGetParamsWithContext(ctx context.Context) *PcloudNetworksGetParams { - var () return &PcloudNetworksGetParams{ - Context: ctx, } } // NewPcloudNetworksGetParamsWithHTTPClient creates a new PcloudNetworksGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudNetworksGetParamsWithHTTPClient(client *http.Client) *PcloudNetworksGetParams { - var () return &PcloudNetworksGetParams{ HTTPClient: client, } } -/*PcloudNetworksGetParams contains all the parameters to send to the API endpoint -for the pcloud networks get operation typically these are written to a http.Request +/* PcloudNetworksGetParams contains all the parameters to send to the API endpoint + for the pcloud networks get operation. + + Typically these are written to a http.Request. */ type PcloudNetworksGetParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*NetworkID - Network ID + /* NetworkID. + + Network ID */ NetworkID string @@ -77,6 +76,21 @@ type PcloudNetworksGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud networks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksGetParams) WithDefaults() *PcloudNetworksGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud networks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud networks get params func (o *PcloudNetworksGetParams) WithTimeout(timeout time.Duration) *PcloudNetworksGetParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_networks/pcloud_networks_get_responses.go b/power/client/p_cloud_networks/pcloud_networks_get_responses.go index 13369bee..d66f5f1b 100644 --- a/power/client/p_cloud_networks/pcloud_networks_get_responses.go +++ b/power/client/p_cloud_networks/pcloud_networks_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudNetworksGetReader is a Reader for the PcloudNetworksGet structure. @@ -24,44 +23,38 @@ type PcloudNetworksGetReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudNetworksGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudNetworksGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudNetworksGetBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudNetworksGetUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudNetworksGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudNetworksGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudNetworksGetOK() *PcloudNetworksGetOK { return &PcloudNetworksGetOK{} } -/*PcloudNetworksGetOK handles this case with default header values. +/* PcloudNetworksGetOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudNetworksGetOK struct { func (o *PcloudNetworksGetOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}][%d] pcloudNetworksGetOK %+v", 200, o.Payload) } +func (o *PcloudNetworksGetOK) GetPayload() *models.Network { + return o.Payload +} func (o *PcloudNetworksGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudNetworksGetBadRequest() *PcloudNetworksGetBadRequest { return &PcloudNetworksGetBadRequest{} } -/*PcloudNetworksGetBadRequest handles this case with default header values. +/* PcloudNetworksGetBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudNetworksGetBadRequest struct { func (o *PcloudNetworksGetBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}][%d] pcloudNetworksGetBadRequest %+v", 400, o.Payload) } +func (o *PcloudNetworksGetBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudNetworksGetUnauthorized() *PcloudNetworksGetUnauthorized { return &PcloudNetworksGetUnauthorized{} } -/*PcloudNetworksGetUnauthorized handles this case with default header values. +/* PcloudNetworksGetUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudNetworksGetUnauthorized struct { func (o *PcloudNetworksGetUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}][%d] pcloudNetworksGetUnauthorized %+v", 401, o.Payload) } +func (o *PcloudNetworksGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudNetworksGetNotFound() *PcloudNetworksGetNotFound { return &PcloudNetworksGetNotFound{} } -/*PcloudNetworksGetNotFound handles this case with default header values. +/* PcloudNetworksGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -168,6 +170,9 @@ type PcloudNetworksGetNotFound struct { func (o *PcloudNetworksGetNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}][%d] pcloudNetworksGetNotFound %+v", 404, o.Payload) } +func (o *PcloudNetworksGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudNetworksGetInternalServerError() *PcloudNetworksGetInternalServerE return &PcloudNetworksGetInternalServerError{} } -/*PcloudNetworksGetInternalServerError handles this case with default header values. +/* PcloudNetworksGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudNetworksGetInternalServerError struct { func (o *PcloudNetworksGetInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}][%d] pcloudNetworksGetInternalServerError %+v", 500, o.Payload) } +func (o *PcloudNetworksGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_networks/pcloud_networks_getall_parameters.go b/power/client/p_cloud_networks/pcloud_networks_getall_parameters.go index f7313c8e..3ec2e1b9 100644 --- a/power/client/p_cloud_networks/pcloud_networks_getall_parameters.go +++ b/power/client/p_cloud_networks/pcloud_networks_getall_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudNetworksGetallParams creates a new PcloudNetworksGetallParams object -// with the default values initialized. +// NewPcloudNetworksGetallParams creates a new PcloudNetworksGetallParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudNetworksGetallParams() *PcloudNetworksGetallParams { - var () return &PcloudNetworksGetallParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudNetworksGetallParamsWithTimeout creates a new PcloudNetworksGetallParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudNetworksGetallParamsWithTimeout(timeout time.Duration) *PcloudNetworksGetallParams { - var () return &PcloudNetworksGetallParams{ - timeout: timeout, } } // NewPcloudNetworksGetallParamsWithContext creates a new PcloudNetworksGetallParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudNetworksGetallParamsWithContext(ctx context.Context) *PcloudNetworksGetallParams { - var () return &PcloudNetworksGetallParams{ - Context: ctx, } } // NewPcloudNetworksGetallParamsWithHTTPClient creates a new PcloudNetworksGetallParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudNetworksGetallParamsWithHTTPClient(client *http.Client) *PcloudNetworksGetallParams { - var () return &PcloudNetworksGetallParams{ HTTPClient: client, } } -/*PcloudNetworksGetallParams contains all the parameters to send to the API endpoint -for the pcloud networks getall operation typically these are written to a http.Request +/* PcloudNetworksGetallParams contains all the parameters to send to the API endpoint + for the pcloud networks getall operation. + + Typically these are written to a http.Request. */ type PcloudNetworksGetallParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*Filter - A filter expression that filters resources listed in the response + /* Filter. + + A filter expression that filters resources listed in the response */ Filter *string @@ -77,6 +76,21 @@ type PcloudNetworksGetallParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud networks getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksGetallParams) WithDefaults() *PcloudNetworksGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud networks getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksGetallParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud networks getall params func (o *PcloudNetworksGetallParams) WithTimeout(timeout time.Duration) *PcloudNetworksGetallParams { o.SetTimeout(timeout) @@ -149,16 +163,17 @@ func (o *PcloudNetworksGetallParams) WriteToRequest(r runtime.ClientRequest, reg // query param filter var qrFilter string + if o.Filter != nil { qrFilter = *o.Filter } qFilter := qrFilter if qFilter != "" { + if err := r.SetQueryParam("filter", qFilter); err != nil { return err } } - } if len(res) > 0 { diff --git a/power/client/p_cloud_networks/pcloud_networks_getall_responses.go b/power/client/p_cloud_networks/pcloud_networks_getall_responses.go index 21c3d2a4..fd07134b 100644 --- a/power/client/p_cloud_networks/pcloud_networks_getall_responses.go +++ b/power/client/p_cloud_networks/pcloud_networks_getall_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudNetworksGetallReader is a Reader for the PcloudNetworksGetall structure. @@ -24,37 +23,32 @@ type PcloudNetworksGetallReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudNetworksGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudNetworksGetallOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudNetworksGetallBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudNetworksGetallUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudNetworksGetallInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -63,7 +57,7 @@ func NewPcloudNetworksGetallOK() *PcloudNetworksGetallOK { return &PcloudNetworksGetallOK{} } -/*PcloudNetworksGetallOK handles this case with default header values. +/* PcloudNetworksGetallOK describes a response with status code 200, with default header values. OK */ @@ -74,6 +68,9 @@ type PcloudNetworksGetallOK struct { func (o *PcloudNetworksGetallOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks][%d] pcloudNetworksGetallOK %+v", 200, o.Payload) } +func (o *PcloudNetworksGetallOK) GetPayload() *models.Networks { + return o.Payload +} func (o *PcloudNetworksGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -92,7 +89,7 @@ func NewPcloudNetworksGetallBadRequest() *PcloudNetworksGetallBadRequest { return &PcloudNetworksGetallBadRequest{} } -/*PcloudNetworksGetallBadRequest handles this case with default header values. +/* PcloudNetworksGetallBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -103,6 +100,9 @@ type PcloudNetworksGetallBadRequest struct { func (o *PcloudNetworksGetallBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks][%d] pcloudNetworksGetallBadRequest %+v", 400, o.Payload) } +func (o *PcloudNetworksGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksGetallBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -121,7 +121,7 @@ func NewPcloudNetworksGetallUnauthorized() *PcloudNetworksGetallUnauthorized { return &PcloudNetworksGetallUnauthorized{} } -/*PcloudNetworksGetallUnauthorized handles this case with default header values. +/* PcloudNetworksGetallUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -132,6 +132,9 @@ type PcloudNetworksGetallUnauthorized struct { func (o *PcloudNetworksGetallUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks][%d] pcloudNetworksGetallUnauthorized %+v", 401, o.Payload) } +func (o *PcloudNetworksGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksGetallUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -150,7 +153,7 @@ func NewPcloudNetworksGetallInternalServerError() *PcloudNetworksGetallInternalS return &PcloudNetworksGetallInternalServerError{} } -/*PcloudNetworksGetallInternalServerError handles this case with default header values. +/* PcloudNetworksGetallInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -161,6 +164,9 @@ type PcloudNetworksGetallInternalServerError struct { func (o *PcloudNetworksGetallInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks][%d] pcloudNetworksGetallInternalServerError %+v", 500, o.Payload) } +func (o *PcloudNetworksGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksGetallInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_networks/pcloud_networks_ports_delete_parameters.go b/power/client/p_cloud_networks/pcloud_networks_ports_delete_parameters.go index 01c40eeb..2782cd9e 100644 --- a/power/client/p_cloud_networks/pcloud_networks_ports_delete_parameters.go +++ b/power/client/p_cloud_networks/pcloud_networks_ports_delete_parameters.go @@ -13,67 +13,67 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudNetworksPortsDeleteParams creates a new PcloudNetworksPortsDeleteParams object -// with the default values initialized. +// NewPcloudNetworksPortsDeleteParams creates a new PcloudNetworksPortsDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudNetworksPortsDeleteParams() *PcloudNetworksPortsDeleteParams { - var () return &PcloudNetworksPortsDeleteParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudNetworksPortsDeleteParamsWithTimeout creates a new PcloudNetworksPortsDeleteParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudNetworksPortsDeleteParamsWithTimeout(timeout time.Duration) *PcloudNetworksPortsDeleteParams { - var () return &PcloudNetworksPortsDeleteParams{ - timeout: timeout, } } // NewPcloudNetworksPortsDeleteParamsWithContext creates a new PcloudNetworksPortsDeleteParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudNetworksPortsDeleteParamsWithContext(ctx context.Context) *PcloudNetworksPortsDeleteParams { - var () return &PcloudNetworksPortsDeleteParams{ - Context: ctx, } } // NewPcloudNetworksPortsDeleteParamsWithHTTPClient creates a new PcloudNetworksPortsDeleteParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudNetworksPortsDeleteParamsWithHTTPClient(client *http.Client) *PcloudNetworksPortsDeleteParams { - var () return &PcloudNetworksPortsDeleteParams{ HTTPClient: client, } } -/*PcloudNetworksPortsDeleteParams contains all the parameters to send to the API endpoint -for the pcloud networks ports delete operation typically these are written to a http.Request +/* PcloudNetworksPortsDeleteParams contains all the parameters to send to the API endpoint + for the pcloud networks ports delete operation. + + Typically these are written to a http.Request. */ type PcloudNetworksPortsDeleteParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*NetworkID - Network ID + /* NetworkID. + + Network ID */ NetworkID string - /*PortID - Port ID + /* PortID. + + Port ID */ PortID string @@ -82,6 +82,21 @@ type PcloudNetworksPortsDeleteParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud networks ports delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksPortsDeleteParams) WithDefaults() *PcloudNetworksPortsDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud networks ports delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksPortsDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud networks ports delete params func (o *PcloudNetworksPortsDeleteParams) WithTimeout(timeout time.Duration) *PcloudNetworksPortsDeleteParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_networks/pcloud_networks_ports_delete_responses.go b/power/client/p_cloud_networks/pcloud_networks_ports_delete_responses.go index 38da0c6c..45c94b02 100644 --- a/power/client/p_cloud_networks/pcloud_networks_ports_delete_responses.go +++ b/power/client/p_cloud_networks/pcloud_networks_ports_delete_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudNetworksPortsDeleteReader is a Reader for the PcloudNetworksPortsDelete structure. @@ -24,44 +23,38 @@ type PcloudNetworksPortsDeleteReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudNetworksPortsDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudNetworksPortsDeleteOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudNetworksPortsDeleteBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudNetworksPortsDeleteUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 410: result := NewPcloudNetworksPortsDeleteGone() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudNetworksPortsDeleteInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudNetworksPortsDeleteOK() *PcloudNetworksPortsDeleteOK { return &PcloudNetworksPortsDeleteOK{} } -/*PcloudNetworksPortsDeleteOK handles this case with default header values. +/* PcloudNetworksPortsDeleteOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudNetworksPortsDeleteOK struct { func (o *PcloudNetworksPortsDeleteOK) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}][%d] pcloudNetworksPortsDeleteOK %+v", 200, o.Payload) } +func (o *PcloudNetworksPortsDeleteOK) GetPayload() models.Object { + return o.Payload +} func (o *PcloudNetworksPortsDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -97,7 +93,7 @@ func NewPcloudNetworksPortsDeleteBadRequest() *PcloudNetworksPortsDeleteBadReque return &PcloudNetworksPortsDeleteBadRequest{} } -/*PcloudNetworksPortsDeleteBadRequest handles this case with default header values. +/* PcloudNetworksPortsDeleteBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -108,6 +104,9 @@ type PcloudNetworksPortsDeleteBadRequest struct { func (o *PcloudNetworksPortsDeleteBadRequest) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}][%d] pcloudNetworksPortsDeleteBadRequest %+v", 400, o.Payload) } +func (o *PcloudNetworksPortsDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksPortsDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -126,7 +125,7 @@ func NewPcloudNetworksPortsDeleteUnauthorized() *PcloudNetworksPortsDeleteUnauth return &PcloudNetworksPortsDeleteUnauthorized{} } -/*PcloudNetworksPortsDeleteUnauthorized handles this case with default header values. +/* PcloudNetworksPortsDeleteUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -137,6 +136,9 @@ type PcloudNetworksPortsDeleteUnauthorized struct { func (o *PcloudNetworksPortsDeleteUnauthorized) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}][%d] pcloudNetworksPortsDeleteUnauthorized %+v", 401, o.Payload) } +func (o *PcloudNetworksPortsDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksPortsDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -155,7 +157,7 @@ func NewPcloudNetworksPortsDeleteGone() *PcloudNetworksPortsDeleteGone { return &PcloudNetworksPortsDeleteGone{} } -/*PcloudNetworksPortsDeleteGone handles this case with default header values. +/* PcloudNetworksPortsDeleteGone describes a response with status code 410, with default header values. Gone */ @@ -166,6 +168,9 @@ type PcloudNetworksPortsDeleteGone struct { func (o *PcloudNetworksPortsDeleteGone) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}][%d] pcloudNetworksPortsDeleteGone %+v", 410, o.Payload) } +func (o *PcloudNetworksPortsDeleteGone) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksPortsDeleteGone) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -184,7 +189,7 @@ func NewPcloudNetworksPortsDeleteInternalServerError() *PcloudNetworksPortsDelet return &PcloudNetworksPortsDeleteInternalServerError{} } -/*PcloudNetworksPortsDeleteInternalServerError handles this case with default header values. +/* PcloudNetworksPortsDeleteInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -195,6 +200,9 @@ type PcloudNetworksPortsDeleteInternalServerError struct { func (o *PcloudNetworksPortsDeleteInternalServerError) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}][%d] pcloudNetworksPortsDeleteInternalServerError %+v", 500, o.Payload) } +func (o *PcloudNetworksPortsDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksPortsDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_networks/pcloud_networks_ports_get_parameters.go b/power/client/p_cloud_networks/pcloud_networks_ports_get_parameters.go index c3ba79d1..cced0387 100644 --- a/power/client/p_cloud_networks/pcloud_networks_ports_get_parameters.go +++ b/power/client/p_cloud_networks/pcloud_networks_ports_get_parameters.go @@ -13,67 +13,67 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudNetworksPortsGetParams creates a new PcloudNetworksPortsGetParams object -// with the default values initialized. +// NewPcloudNetworksPortsGetParams creates a new PcloudNetworksPortsGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudNetworksPortsGetParams() *PcloudNetworksPortsGetParams { - var () return &PcloudNetworksPortsGetParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudNetworksPortsGetParamsWithTimeout creates a new PcloudNetworksPortsGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudNetworksPortsGetParamsWithTimeout(timeout time.Duration) *PcloudNetworksPortsGetParams { - var () return &PcloudNetworksPortsGetParams{ - timeout: timeout, } } // NewPcloudNetworksPortsGetParamsWithContext creates a new PcloudNetworksPortsGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudNetworksPortsGetParamsWithContext(ctx context.Context) *PcloudNetworksPortsGetParams { - var () return &PcloudNetworksPortsGetParams{ - Context: ctx, } } // NewPcloudNetworksPortsGetParamsWithHTTPClient creates a new PcloudNetworksPortsGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudNetworksPortsGetParamsWithHTTPClient(client *http.Client) *PcloudNetworksPortsGetParams { - var () return &PcloudNetworksPortsGetParams{ HTTPClient: client, } } -/*PcloudNetworksPortsGetParams contains all the parameters to send to the API endpoint -for the pcloud networks ports get operation typically these are written to a http.Request +/* PcloudNetworksPortsGetParams contains all the parameters to send to the API endpoint + for the pcloud networks ports get operation. + + Typically these are written to a http.Request. */ type PcloudNetworksPortsGetParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*NetworkID - Network ID + /* NetworkID. + + Network ID */ NetworkID string - /*PortID - Port ID + /* PortID. + + Port ID */ PortID string @@ -82,6 +82,21 @@ type PcloudNetworksPortsGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud networks ports get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksPortsGetParams) WithDefaults() *PcloudNetworksPortsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud networks ports get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksPortsGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud networks ports get params func (o *PcloudNetworksPortsGetParams) WithTimeout(timeout time.Duration) *PcloudNetworksPortsGetParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_networks/pcloud_networks_ports_get_responses.go b/power/client/p_cloud_networks/pcloud_networks_ports_get_responses.go index d41c736d..70ff78c3 100644 --- a/power/client/p_cloud_networks/pcloud_networks_ports_get_responses.go +++ b/power/client/p_cloud_networks/pcloud_networks_ports_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudNetworksPortsGetReader is a Reader for the PcloudNetworksPortsGet structure. @@ -24,37 +23,32 @@ type PcloudNetworksPortsGetReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudNetworksPortsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudNetworksPortsGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 401: result := NewPcloudNetworksPortsGetUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudNetworksPortsGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudNetworksPortsGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -63,7 +57,7 @@ func NewPcloudNetworksPortsGetOK() *PcloudNetworksPortsGetOK { return &PcloudNetworksPortsGetOK{} } -/*PcloudNetworksPortsGetOK handles this case with default header values. +/* PcloudNetworksPortsGetOK describes a response with status code 200, with default header values. OK */ @@ -74,6 +68,9 @@ type PcloudNetworksPortsGetOK struct { func (o *PcloudNetworksPortsGetOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}][%d] pcloudNetworksPortsGetOK %+v", 200, o.Payload) } +func (o *PcloudNetworksPortsGetOK) GetPayload() *models.NetworkPort { + return o.Payload +} func (o *PcloudNetworksPortsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -92,7 +89,7 @@ func NewPcloudNetworksPortsGetUnauthorized() *PcloudNetworksPortsGetUnauthorized return &PcloudNetworksPortsGetUnauthorized{} } -/*PcloudNetworksPortsGetUnauthorized handles this case with default header values. +/* PcloudNetworksPortsGetUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -103,6 +100,9 @@ type PcloudNetworksPortsGetUnauthorized struct { func (o *PcloudNetworksPortsGetUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}][%d] pcloudNetworksPortsGetUnauthorized %+v", 401, o.Payload) } +func (o *PcloudNetworksPortsGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksPortsGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -121,7 +121,7 @@ func NewPcloudNetworksPortsGetNotFound() *PcloudNetworksPortsGetNotFound { return &PcloudNetworksPortsGetNotFound{} } -/*PcloudNetworksPortsGetNotFound handles this case with default header values. +/* PcloudNetworksPortsGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -132,6 +132,9 @@ type PcloudNetworksPortsGetNotFound struct { func (o *PcloudNetworksPortsGetNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}][%d] pcloudNetworksPortsGetNotFound %+v", 404, o.Payload) } +func (o *PcloudNetworksPortsGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksPortsGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -150,7 +153,7 @@ func NewPcloudNetworksPortsGetInternalServerError() *PcloudNetworksPortsGetInter return &PcloudNetworksPortsGetInternalServerError{} } -/*PcloudNetworksPortsGetInternalServerError handles this case with default header values. +/* PcloudNetworksPortsGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -161,6 +164,9 @@ type PcloudNetworksPortsGetInternalServerError struct { func (o *PcloudNetworksPortsGetInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}][%d] pcloudNetworksPortsGetInternalServerError %+v", 500, o.Payload) } +func (o *PcloudNetworksPortsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksPortsGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_networks/pcloud_networks_ports_getall_parameters.go b/power/client/p_cloud_networks/pcloud_networks_ports_getall_parameters.go index 5dbb41a1..bae1e681 100644 --- a/power/client/p_cloud_networks/pcloud_networks_ports_getall_parameters.go +++ b/power/client/p_cloud_networks/pcloud_networks_ports_getall_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudNetworksPortsGetallParams creates a new PcloudNetworksPortsGetallParams object -// with the default values initialized. +// NewPcloudNetworksPortsGetallParams creates a new PcloudNetworksPortsGetallParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudNetworksPortsGetallParams() *PcloudNetworksPortsGetallParams { - var () return &PcloudNetworksPortsGetallParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudNetworksPortsGetallParamsWithTimeout creates a new PcloudNetworksPortsGetallParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudNetworksPortsGetallParamsWithTimeout(timeout time.Duration) *PcloudNetworksPortsGetallParams { - var () return &PcloudNetworksPortsGetallParams{ - timeout: timeout, } } // NewPcloudNetworksPortsGetallParamsWithContext creates a new PcloudNetworksPortsGetallParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudNetworksPortsGetallParamsWithContext(ctx context.Context) *PcloudNetworksPortsGetallParams { - var () return &PcloudNetworksPortsGetallParams{ - Context: ctx, } } // NewPcloudNetworksPortsGetallParamsWithHTTPClient creates a new PcloudNetworksPortsGetallParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudNetworksPortsGetallParamsWithHTTPClient(client *http.Client) *PcloudNetworksPortsGetallParams { - var () return &PcloudNetworksPortsGetallParams{ HTTPClient: client, } } -/*PcloudNetworksPortsGetallParams contains all the parameters to send to the API endpoint -for the pcloud networks ports getall operation typically these are written to a http.Request +/* PcloudNetworksPortsGetallParams contains all the parameters to send to the API endpoint + for the pcloud networks ports getall operation. + + Typically these are written to a http.Request. */ type PcloudNetworksPortsGetallParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*NetworkID - Network ID + /* NetworkID. + + Network ID */ NetworkID string @@ -77,6 +76,21 @@ type PcloudNetworksPortsGetallParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud networks ports getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksPortsGetallParams) WithDefaults() *PcloudNetworksPortsGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud networks ports getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksPortsGetallParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud networks ports getall params func (o *PcloudNetworksPortsGetallParams) WithTimeout(timeout time.Duration) *PcloudNetworksPortsGetallParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_networks/pcloud_networks_ports_getall_responses.go b/power/client/p_cloud_networks/pcloud_networks_ports_getall_responses.go index 174f34a0..4c5a2100 100644 --- a/power/client/p_cloud_networks/pcloud_networks_ports_getall_responses.go +++ b/power/client/p_cloud_networks/pcloud_networks_ports_getall_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudNetworksPortsGetallReader is a Reader for the PcloudNetworksPortsGetall structure. @@ -24,37 +23,32 @@ type PcloudNetworksPortsGetallReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudNetworksPortsGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudNetworksPortsGetallOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudNetworksPortsGetallBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudNetworksPortsGetallUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudNetworksPortsGetallInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -63,7 +57,7 @@ func NewPcloudNetworksPortsGetallOK() *PcloudNetworksPortsGetallOK { return &PcloudNetworksPortsGetallOK{} } -/*PcloudNetworksPortsGetallOK handles this case with default header values. +/* PcloudNetworksPortsGetallOK describes a response with status code 200, with default header values. OK */ @@ -74,6 +68,9 @@ type PcloudNetworksPortsGetallOK struct { func (o *PcloudNetworksPortsGetallOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports][%d] pcloudNetworksPortsGetallOK %+v", 200, o.Payload) } +func (o *PcloudNetworksPortsGetallOK) GetPayload() *models.NetworkPorts { + return o.Payload +} func (o *PcloudNetworksPortsGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -92,7 +89,7 @@ func NewPcloudNetworksPortsGetallBadRequest() *PcloudNetworksPortsGetallBadReque return &PcloudNetworksPortsGetallBadRequest{} } -/*PcloudNetworksPortsGetallBadRequest handles this case with default header values. +/* PcloudNetworksPortsGetallBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -103,6 +100,9 @@ type PcloudNetworksPortsGetallBadRequest struct { func (o *PcloudNetworksPortsGetallBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports][%d] pcloudNetworksPortsGetallBadRequest %+v", 400, o.Payload) } +func (o *PcloudNetworksPortsGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksPortsGetallBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -121,7 +121,7 @@ func NewPcloudNetworksPortsGetallUnauthorized() *PcloudNetworksPortsGetallUnauth return &PcloudNetworksPortsGetallUnauthorized{} } -/*PcloudNetworksPortsGetallUnauthorized handles this case with default header values. +/* PcloudNetworksPortsGetallUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -132,6 +132,9 @@ type PcloudNetworksPortsGetallUnauthorized struct { func (o *PcloudNetworksPortsGetallUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports][%d] pcloudNetworksPortsGetallUnauthorized %+v", 401, o.Payload) } +func (o *PcloudNetworksPortsGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksPortsGetallUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -150,7 +153,7 @@ func NewPcloudNetworksPortsGetallInternalServerError() *PcloudNetworksPortsGetal return &PcloudNetworksPortsGetallInternalServerError{} } -/*PcloudNetworksPortsGetallInternalServerError handles this case with default header values. +/* PcloudNetworksPortsGetallInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -161,6 +164,9 @@ type PcloudNetworksPortsGetallInternalServerError struct { func (o *PcloudNetworksPortsGetallInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports][%d] pcloudNetworksPortsGetallInternalServerError %+v", 500, o.Payload) } +func (o *PcloudNetworksPortsGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksPortsGetallInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_networks/pcloud_networks_ports_post_parameters.go b/power/client/p_cloud_networks/pcloud_networks_ports_post_parameters.go index 37863da8..ffeb9359 100644 --- a/power/client/p_cloud_networks/pcloud_networks_ports_post_parameters.go +++ b/power/client/p_cloud_networks/pcloud_networks_ports_post_parameters.go @@ -13,69 +13,69 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudNetworksPortsPostParams creates a new PcloudNetworksPortsPostParams object -// with the default values initialized. +// NewPcloudNetworksPortsPostParams creates a new PcloudNetworksPortsPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudNetworksPortsPostParams() *PcloudNetworksPortsPostParams { - var () return &PcloudNetworksPortsPostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudNetworksPortsPostParamsWithTimeout creates a new PcloudNetworksPortsPostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudNetworksPortsPostParamsWithTimeout(timeout time.Duration) *PcloudNetworksPortsPostParams { - var () return &PcloudNetworksPortsPostParams{ - timeout: timeout, } } // NewPcloudNetworksPortsPostParamsWithContext creates a new PcloudNetworksPortsPostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudNetworksPortsPostParamsWithContext(ctx context.Context) *PcloudNetworksPortsPostParams { - var () return &PcloudNetworksPortsPostParams{ - Context: ctx, } } // NewPcloudNetworksPortsPostParamsWithHTTPClient creates a new PcloudNetworksPortsPostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudNetworksPortsPostParamsWithHTTPClient(client *http.Client) *PcloudNetworksPortsPostParams { - var () return &PcloudNetworksPortsPostParams{ HTTPClient: client, } } -/*PcloudNetworksPortsPostParams contains all the parameters to send to the API endpoint -for the pcloud networks ports post operation typically these are written to a http.Request +/* PcloudNetworksPortsPostParams contains all the parameters to send to the API endpoint + for the pcloud networks ports post operation. + + Typically these are written to a http.Request. */ type PcloudNetworksPortsPostParams struct { - /*Body - Create a Network Port + /* Body. + Create a Network Port */ Body *models.NetworkPortCreate - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*NetworkID - Network ID + /* NetworkID. + + Network ID */ NetworkID string @@ -84,6 +84,21 @@ type PcloudNetworksPortsPostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud networks ports post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksPortsPostParams) WithDefaults() *PcloudNetworksPortsPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud networks ports post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksPortsPostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud networks ports post params func (o *PcloudNetworksPortsPostParams) WithTimeout(timeout time.Duration) *PcloudNetworksPortsPostParams { o.SetTimeout(timeout) @@ -157,7 +172,6 @@ func (o *PcloudNetworksPortsPostParams) WriteToRequest(r runtime.ClientRequest, return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_networks/pcloud_networks_ports_post_responses.go b/power/client/p_cloud_networks/pcloud_networks_ports_post_responses.go index fc2881e2..a284e8b3 100644 --- a/power/client/p_cloud_networks/pcloud_networks_ports_post_responses.go +++ b/power/client/p_cloud_networks/pcloud_networks_ports_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudNetworksPortsPostReader is a Reader for the PcloudNetworksPortsPost structure. @@ -24,51 +23,44 @@ type PcloudNetworksPortsPostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudNetworksPortsPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 201: result := NewPcloudNetworksPortsPostCreated() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudNetworksPortsPostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudNetworksPortsPostUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 409: result := NewPcloudNetworksPortsPostConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudNetworksPortsPostUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudNetworksPortsPostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -77,7 +69,7 @@ func NewPcloudNetworksPortsPostCreated() *PcloudNetworksPortsPostCreated { return &PcloudNetworksPortsPostCreated{} } -/*PcloudNetworksPortsPostCreated handles this case with default header values. +/* PcloudNetworksPortsPostCreated describes a response with status code 201, with default header values. Created */ @@ -88,6 +80,9 @@ type PcloudNetworksPortsPostCreated struct { func (o *PcloudNetworksPortsPostCreated) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports][%d] pcloudNetworksPortsPostCreated %+v", 201, o.Payload) } +func (o *PcloudNetworksPortsPostCreated) GetPayload() *models.NetworkPort { + return o.Payload +} func (o *PcloudNetworksPortsPostCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -106,7 +101,7 @@ func NewPcloudNetworksPortsPostBadRequest() *PcloudNetworksPortsPostBadRequest { return &PcloudNetworksPortsPostBadRequest{} } -/*PcloudNetworksPortsPostBadRequest handles this case with default header values. +/* PcloudNetworksPortsPostBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -117,6 +112,9 @@ type PcloudNetworksPortsPostBadRequest struct { func (o *PcloudNetworksPortsPostBadRequest) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports][%d] pcloudNetworksPortsPostBadRequest %+v", 400, o.Payload) } +func (o *PcloudNetworksPortsPostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksPortsPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -135,7 +133,7 @@ func NewPcloudNetworksPortsPostUnauthorized() *PcloudNetworksPortsPostUnauthoriz return &PcloudNetworksPortsPostUnauthorized{} } -/*PcloudNetworksPortsPostUnauthorized handles this case with default header values. +/* PcloudNetworksPortsPostUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -146,6 +144,9 @@ type PcloudNetworksPortsPostUnauthorized struct { func (o *PcloudNetworksPortsPostUnauthorized) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports][%d] pcloudNetworksPortsPostUnauthorized %+v", 401, o.Payload) } +func (o *PcloudNetworksPortsPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksPortsPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -164,7 +165,7 @@ func NewPcloudNetworksPortsPostConflict() *PcloudNetworksPortsPostConflict { return &PcloudNetworksPortsPostConflict{} } -/*PcloudNetworksPortsPostConflict handles this case with default header values. +/* PcloudNetworksPortsPostConflict describes a response with status code 409, with default header values. Conflict */ @@ -175,6 +176,9 @@ type PcloudNetworksPortsPostConflict struct { func (o *PcloudNetworksPortsPostConflict) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports][%d] pcloudNetworksPortsPostConflict %+v", 409, o.Payload) } +func (o *PcloudNetworksPortsPostConflict) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksPortsPostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -193,7 +197,7 @@ func NewPcloudNetworksPortsPostUnprocessableEntity() *PcloudNetworksPortsPostUnp return &PcloudNetworksPortsPostUnprocessableEntity{} } -/*PcloudNetworksPortsPostUnprocessableEntity handles this case with default header values. +/* PcloudNetworksPortsPostUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -204,6 +208,9 @@ type PcloudNetworksPortsPostUnprocessableEntity struct { func (o *PcloudNetworksPortsPostUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports][%d] pcloudNetworksPortsPostUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudNetworksPortsPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksPortsPostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -222,7 +229,7 @@ func NewPcloudNetworksPortsPostInternalServerError() *PcloudNetworksPortsPostInt return &PcloudNetworksPortsPostInternalServerError{} } -/*PcloudNetworksPortsPostInternalServerError handles this case with default header values. +/* PcloudNetworksPortsPostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -233,6 +240,9 @@ type PcloudNetworksPortsPostInternalServerError struct { func (o *PcloudNetworksPortsPostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports][%d] pcloudNetworksPortsPostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudNetworksPortsPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksPortsPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_networks/pcloud_networks_ports_put_parameters.go b/power/client/p_cloud_networks/pcloud_networks_ports_put_parameters.go index 460a6538..fce7c87e 100644 --- a/power/client/p_cloud_networks/pcloud_networks_ports_put_parameters.go +++ b/power/client/p_cloud_networks/pcloud_networks_ports_put_parameters.go @@ -13,74 +13,75 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudNetworksPortsPutParams creates a new PcloudNetworksPortsPutParams object -// with the default values initialized. +// NewPcloudNetworksPortsPutParams creates a new PcloudNetworksPortsPutParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudNetworksPortsPutParams() *PcloudNetworksPortsPutParams { - var () return &PcloudNetworksPortsPutParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudNetworksPortsPutParamsWithTimeout creates a new PcloudNetworksPortsPutParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudNetworksPortsPutParamsWithTimeout(timeout time.Duration) *PcloudNetworksPortsPutParams { - var () return &PcloudNetworksPortsPutParams{ - timeout: timeout, } } // NewPcloudNetworksPortsPutParamsWithContext creates a new PcloudNetworksPortsPutParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudNetworksPortsPutParamsWithContext(ctx context.Context) *PcloudNetworksPortsPutParams { - var () return &PcloudNetworksPortsPutParams{ - Context: ctx, } } // NewPcloudNetworksPortsPutParamsWithHTTPClient creates a new PcloudNetworksPortsPutParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudNetworksPortsPutParamsWithHTTPClient(client *http.Client) *PcloudNetworksPortsPutParams { - var () return &PcloudNetworksPortsPutParams{ HTTPClient: client, } } -/*PcloudNetworksPortsPutParams contains all the parameters to send to the API endpoint -for the pcloud networks ports put operation typically these are written to a http.Request +/* PcloudNetworksPortsPutParams contains all the parameters to send to the API endpoint + for the pcloud networks ports put operation. + + Typically these are written to a http.Request. */ type PcloudNetworksPortsPutParams struct { - /*Body - Parameters for updating a Port + /* Body. + Parameters for updating a Port */ Body *models.NetworkPortUpdate - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*NetworkID - Network ID + /* NetworkID. + + Network ID */ NetworkID string - /*PortID - Port ID + /* PortID. + + Port ID */ PortID string @@ -89,6 +90,21 @@ type PcloudNetworksPortsPutParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud networks ports put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksPortsPutParams) WithDefaults() *PcloudNetworksPortsPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud networks ports put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksPortsPutParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud networks ports put params func (o *PcloudNetworksPortsPutParams) WithTimeout(timeout time.Duration) *PcloudNetworksPortsPutParams { o.SetTimeout(timeout) @@ -173,7 +189,6 @@ func (o *PcloudNetworksPortsPutParams) WriteToRequest(r runtime.ClientRequest, r return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_networks/pcloud_networks_ports_put_responses.go b/power/client/p_cloud_networks/pcloud_networks_ports_put_responses.go index c801e5f8..4fc8e47d 100644 --- a/power/client/p_cloud_networks/pcloud_networks_ports_put_responses.go +++ b/power/client/p_cloud_networks/pcloud_networks_ports_put_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudNetworksPortsPutReader is a Reader for the PcloudNetworksPortsPut structure. @@ -24,44 +23,38 @@ type PcloudNetworksPortsPutReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudNetworksPortsPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudNetworksPortsPutOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudNetworksPortsPutBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudNetworksPortsPutUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudNetworksPortsPutUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudNetworksPortsPutInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudNetworksPortsPutOK() *PcloudNetworksPortsPutOK { return &PcloudNetworksPortsPutOK{} } -/*PcloudNetworksPortsPutOK handles this case with default header values. +/* PcloudNetworksPortsPutOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudNetworksPortsPutOK struct { func (o *PcloudNetworksPortsPutOK) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}][%d] pcloudNetworksPortsPutOK %+v", 200, o.Payload) } +func (o *PcloudNetworksPortsPutOK) GetPayload() *models.NetworkPort { + return o.Payload +} func (o *PcloudNetworksPortsPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudNetworksPortsPutBadRequest() *PcloudNetworksPortsPutBadRequest { return &PcloudNetworksPortsPutBadRequest{} } -/*PcloudNetworksPortsPutBadRequest handles this case with default header values. +/* PcloudNetworksPortsPutBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudNetworksPortsPutBadRequest struct { func (o *PcloudNetworksPortsPutBadRequest) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}][%d] pcloudNetworksPortsPutBadRequest %+v", 400, o.Payload) } +func (o *PcloudNetworksPortsPutBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksPortsPutBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudNetworksPortsPutUnauthorized() *PcloudNetworksPortsPutUnauthorized return &PcloudNetworksPortsPutUnauthorized{} } -/*PcloudNetworksPortsPutUnauthorized handles this case with default header values. +/* PcloudNetworksPortsPutUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudNetworksPortsPutUnauthorized struct { func (o *PcloudNetworksPortsPutUnauthorized) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}][%d] pcloudNetworksPortsPutUnauthorized %+v", 401, o.Payload) } +func (o *PcloudNetworksPortsPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksPortsPutUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudNetworksPortsPutUnprocessableEntity() *PcloudNetworksPortsPutUnpro return &PcloudNetworksPortsPutUnprocessableEntity{} } -/*PcloudNetworksPortsPutUnprocessableEntity handles this case with default header values. +/* PcloudNetworksPortsPutUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -168,6 +170,9 @@ type PcloudNetworksPortsPutUnprocessableEntity struct { func (o *PcloudNetworksPortsPutUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}][%d] pcloudNetworksPortsPutUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudNetworksPortsPutUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksPortsPutUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudNetworksPortsPutInternalServerError() *PcloudNetworksPortsPutInter return &PcloudNetworksPortsPutInternalServerError{} } -/*PcloudNetworksPortsPutInternalServerError handles this case with default header values. +/* PcloudNetworksPortsPutInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudNetworksPortsPutInternalServerError struct { func (o *PcloudNetworksPortsPutInternalServerError) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}][%d] pcloudNetworksPortsPutInternalServerError %+v", 500, o.Payload) } +func (o *PcloudNetworksPortsPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksPortsPutInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_networks/pcloud_networks_post_parameters.go b/power/client/p_cloud_networks/pcloud_networks_post_parameters.go index 69c23887..dea14d36 100644 --- a/power/client/p_cloud_networks/pcloud_networks_post_parameters.go +++ b/power/client/p_cloud_networks/pcloud_networks_post_parameters.go @@ -13,64 +13,63 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudNetworksPostParams creates a new PcloudNetworksPostParams object -// with the default values initialized. +// NewPcloudNetworksPostParams creates a new PcloudNetworksPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudNetworksPostParams() *PcloudNetworksPostParams { - var () return &PcloudNetworksPostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudNetworksPostParamsWithTimeout creates a new PcloudNetworksPostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudNetworksPostParamsWithTimeout(timeout time.Duration) *PcloudNetworksPostParams { - var () return &PcloudNetworksPostParams{ - timeout: timeout, } } // NewPcloudNetworksPostParamsWithContext creates a new PcloudNetworksPostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudNetworksPostParamsWithContext(ctx context.Context) *PcloudNetworksPostParams { - var () return &PcloudNetworksPostParams{ - Context: ctx, } } // NewPcloudNetworksPostParamsWithHTTPClient creates a new PcloudNetworksPostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudNetworksPostParamsWithHTTPClient(client *http.Client) *PcloudNetworksPostParams { - var () return &PcloudNetworksPostParams{ HTTPClient: client, } } -/*PcloudNetworksPostParams contains all the parameters to send to the API endpoint -for the pcloud networks post operation typically these are written to a http.Request +/* PcloudNetworksPostParams contains all the parameters to send to the API endpoint + for the pcloud networks post operation. + + Typically these are written to a http.Request. */ type PcloudNetworksPostParams struct { - /*Body - Parameters for the creation of a new network + /* Body. + Parameters for the creation of a new network */ Body *models.NetworkCreate - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -79,6 +78,21 @@ type PcloudNetworksPostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud networks post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksPostParams) WithDefaults() *PcloudNetworksPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud networks post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksPostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud networks post params func (o *PcloudNetworksPostParams) WithTimeout(timeout time.Duration) *PcloudNetworksPostParams { o.SetTimeout(timeout) @@ -141,7 +155,6 @@ func (o *PcloudNetworksPostParams) WriteToRequest(r runtime.ClientRequest, reg s return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_networks/pcloud_networks_post_responses.go b/power/client/p_cloud_networks/pcloud_networks_post_responses.go index 5fd00200..27a0da33 100644 --- a/power/client/p_cloud_networks/pcloud_networks_post_responses.go +++ b/power/client/p_cloud_networks/pcloud_networks_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudNetworksPostReader is a Reader for the PcloudNetworksPost structure. @@ -24,58 +23,50 @@ type PcloudNetworksPostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudNetworksPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudNetworksPostOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 201: result := NewPcloudNetworksPostCreated() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudNetworksPostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudNetworksPostUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 409: result := NewPcloudNetworksPostConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudNetworksPostUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudNetworksPostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -84,7 +75,7 @@ func NewPcloudNetworksPostOK() *PcloudNetworksPostOK { return &PcloudNetworksPostOK{} } -/*PcloudNetworksPostOK handles this case with default header values. +/* PcloudNetworksPostOK describes a response with status code 200, with default header values. OK */ @@ -95,6 +86,9 @@ type PcloudNetworksPostOK struct { func (o *PcloudNetworksPostOK) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/networks][%d] pcloudNetworksPostOK %+v", 200, o.Payload) } +func (o *PcloudNetworksPostOK) GetPayload() *models.Network { + return o.Payload +} func (o *PcloudNetworksPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -113,7 +107,7 @@ func NewPcloudNetworksPostCreated() *PcloudNetworksPostCreated { return &PcloudNetworksPostCreated{} } -/*PcloudNetworksPostCreated handles this case with default header values. +/* PcloudNetworksPostCreated describes a response with status code 201, with default header values. Created */ @@ -124,6 +118,9 @@ type PcloudNetworksPostCreated struct { func (o *PcloudNetworksPostCreated) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/networks][%d] pcloudNetworksPostCreated %+v", 201, o.Payload) } +func (o *PcloudNetworksPostCreated) GetPayload() *models.Network { + return o.Payload +} func (o *PcloudNetworksPostCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -142,7 +139,7 @@ func NewPcloudNetworksPostBadRequest() *PcloudNetworksPostBadRequest { return &PcloudNetworksPostBadRequest{} } -/*PcloudNetworksPostBadRequest handles this case with default header values. +/* PcloudNetworksPostBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -153,6 +150,9 @@ type PcloudNetworksPostBadRequest struct { func (o *PcloudNetworksPostBadRequest) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/networks][%d] pcloudNetworksPostBadRequest %+v", 400, o.Payload) } +func (o *PcloudNetworksPostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -171,7 +171,7 @@ func NewPcloudNetworksPostUnauthorized() *PcloudNetworksPostUnauthorized { return &PcloudNetworksPostUnauthorized{} } -/*PcloudNetworksPostUnauthorized handles this case with default header values. +/* PcloudNetworksPostUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -182,6 +182,9 @@ type PcloudNetworksPostUnauthorized struct { func (o *PcloudNetworksPostUnauthorized) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/networks][%d] pcloudNetworksPostUnauthorized %+v", 401, o.Payload) } +func (o *PcloudNetworksPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -200,7 +203,7 @@ func NewPcloudNetworksPostConflict() *PcloudNetworksPostConflict { return &PcloudNetworksPostConflict{} } -/*PcloudNetworksPostConflict handles this case with default header values. +/* PcloudNetworksPostConflict describes a response with status code 409, with default header values. Conflict */ @@ -211,6 +214,9 @@ type PcloudNetworksPostConflict struct { func (o *PcloudNetworksPostConflict) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/networks][%d] pcloudNetworksPostConflict %+v", 409, o.Payload) } +func (o *PcloudNetworksPostConflict) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksPostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -229,7 +235,7 @@ func NewPcloudNetworksPostUnprocessableEntity() *PcloudNetworksPostUnprocessable return &PcloudNetworksPostUnprocessableEntity{} } -/*PcloudNetworksPostUnprocessableEntity handles this case with default header values. +/* PcloudNetworksPostUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -240,6 +246,9 @@ type PcloudNetworksPostUnprocessableEntity struct { func (o *PcloudNetworksPostUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/networks][%d] pcloudNetworksPostUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudNetworksPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksPostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -258,7 +267,7 @@ func NewPcloudNetworksPostInternalServerError() *PcloudNetworksPostInternalServe return &PcloudNetworksPostInternalServerError{} } -/*PcloudNetworksPostInternalServerError handles this case with default header values. +/* PcloudNetworksPostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -269,6 +278,9 @@ type PcloudNetworksPostInternalServerError struct { func (o *PcloudNetworksPostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/networks][%d] pcloudNetworksPostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudNetworksPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_networks/pcloud_networks_put_parameters.go b/power/client/p_cloud_networks/pcloud_networks_put_parameters.go index 4c5ff09c..00ef70f9 100644 --- a/power/client/p_cloud_networks/pcloud_networks_put_parameters.go +++ b/power/client/p_cloud_networks/pcloud_networks_put_parameters.go @@ -13,69 +13,69 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudNetworksPutParams creates a new PcloudNetworksPutParams object -// with the default values initialized. +// NewPcloudNetworksPutParams creates a new PcloudNetworksPutParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudNetworksPutParams() *PcloudNetworksPutParams { - var () return &PcloudNetworksPutParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudNetworksPutParamsWithTimeout creates a new PcloudNetworksPutParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudNetworksPutParamsWithTimeout(timeout time.Duration) *PcloudNetworksPutParams { - var () return &PcloudNetworksPutParams{ - timeout: timeout, } } // NewPcloudNetworksPutParamsWithContext creates a new PcloudNetworksPutParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudNetworksPutParamsWithContext(ctx context.Context) *PcloudNetworksPutParams { - var () return &PcloudNetworksPutParams{ - Context: ctx, } } // NewPcloudNetworksPutParamsWithHTTPClient creates a new PcloudNetworksPutParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudNetworksPutParamsWithHTTPClient(client *http.Client) *PcloudNetworksPutParams { - var () return &PcloudNetworksPutParams{ HTTPClient: client, } } -/*PcloudNetworksPutParams contains all the parameters to send to the API endpoint -for the pcloud networks put operation typically these are written to a http.Request +/* PcloudNetworksPutParams contains all the parameters to send to the API endpoint + for the pcloud networks put operation. + + Typically these are written to a http.Request. */ type PcloudNetworksPutParams struct { - /*Body - Parameters to update a Network + /* Body. + Parameters to update a Network */ Body *models.NetworkUpdate - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*NetworkID - Network ID + /* NetworkID. + + Network ID */ NetworkID string @@ -84,6 +84,21 @@ type PcloudNetworksPutParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud networks put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksPutParams) WithDefaults() *PcloudNetworksPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud networks put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksPutParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud networks put params func (o *PcloudNetworksPutParams) WithTimeout(timeout time.Duration) *PcloudNetworksPutParams { o.SetTimeout(timeout) @@ -157,7 +172,6 @@ func (o *PcloudNetworksPutParams) WriteToRequest(r runtime.ClientRequest, reg st return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_networks/pcloud_networks_put_responses.go b/power/client/p_cloud_networks/pcloud_networks_put_responses.go index accda0c9..935956e0 100644 --- a/power/client/p_cloud_networks/pcloud_networks_put_responses.go +++ b/power/client/p_cloud_networks/pcloud_networks_put_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudNetworksPutReader is a Reader for the PcloudNetworksPut structure. @@ -24,44 +23,38 @@ type PcloudNetworksPutReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudNetworksPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudNetworksPutOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudNetworksPutBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudNetworksPutUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudNetworksPutUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudNetworksPutInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudNetworksPutOK() *PcloudNetworksPutOK { return &PcloudNetworksPutOK{} } -/*PcloudNetworksPutOK handles this case with default header values. +/* PcloudNetworksPutOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudNetworksPutOK struct { func (o *PcloudNetworksPutOK) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}][%d] pcloudNetworksPutOK %+v", 200, o.Payload) } +func (o *PcloudNetworksPutOK) GetPayload() *models.Network { + return o.Payload +} func (o *PcloudNetworksPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudNetworksPutBadRequest() *PcloudNetworksPutBadRequest { return &PcloudNetworksPutBadRequest{} } -/*PcloudNetworksPutBadRequest handles this case with default header values. +/* PcloudNetworksPutBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudNetworksPutBadRequest struct { func (o *PcloudNetworksPutBadRequest) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}][%d] pcloudNetworksPutBadRequest %+v", 400, o.Payload) } +func (o *PcloudNetworksPutBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksPutBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudNetworksPutUnauthorized() *PcloudNetworksPutUnauthorized { return &PcloudNetworksPutUnauthorized{} } -/*PcloudNetworksPutUnauthorized handles this case with default header values. +/* PcloudNetworksPutUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudNetworksPutUnauthorized struct { func (o *PcloudNetworksPutUnauthorized) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}][%d] pcloudNetworksPutUnauthorized %+v", 401, o.Payload) } +func (o *PcloudNetworksPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksPutUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudNetworksPutUnprocessableEntity() *PcloudNetworksPutUnprocessableEn return &PcloudNetworksPutUnprocessableEntity{} } -/*PcloudNetworksPutUnprocessableEntity handles this case with default header values. +/* PcloudNetworksPutUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -168,6 +170,9 @@ type PcloudNetworksPutUnprocessableEntity struct { func (o *PcloudNetworksPutUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}][%d] pcloudNetworksPutUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudNetworksPutUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksPutUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudNetworksPutInternalServerError() *PcloudNetworksPutInternalServerE return &PcloudNetworksPutInternalServerError{} } -/*PcloudNetworksPutInternalServerError handles this case with default header values. +/* PcloudNetworksPutInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudNetworksPutInternalServerError struct { func (o *PcloudNetworksPutInternalServerError) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}][%d] pcloudNetworksPutInternalServerError %+v", 500, o.Payload) } +func (o *PcloudNetworksPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudNetworksPutInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_p_vm_instances/p_cloud_p_vm_instances_client.go b/power/client/p_cloud_p_vm_instances/p_cloud_p_vm_instances_client.go deleted file mode 100644 index ccf5bba1..00000000 --- a/power/client/p_cloud_p_vm_instances/p_cloud_p_vm_instances_client.go +++ /dev/null @@ -1,653 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package p_cloud_p_vm_instances - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "github.com/go-openapi/runtime" - - strfmt "github.com/go-openapi/strfmt" -) - -// New creates a new p cloud p vm instances API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { - return &Client{transport: transport, formats: formats} -} - -/* -Client for p cloud p vm instances API -*/ -type Client struct { - transport runtime.ClientTransport - formats strfmt.Registry -} - -/* -PcloudPvminstancesActionPost performs an action start stop reboot immediate shutdown reset on a p VM instance -*/ -func (a *Client) PcloudPvminstancesActionPost(params *PcloudPvminstancesActionPostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudPvminstancesActionPostOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudPvminstancesActionPostParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.pvminstances.action.post", - Method: "POST", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/action", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudPvminstancesActionPostReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudPvminstancesActionPostOK), nil - -} - -/* -PcloudPvminstancesCapturePost captures a p VM instance and create a deployable image -*/ -func (a *Client) PcloudPvminstancesCapturePost(params *PcloudPvminstancesCapturePostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudPvminstancesCapturePostOK, *PcloudPvminstancesCapturePostAccepted, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudPvminstancesCapturePostParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.pvminstances.capture.post", - Method: "POST", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudPvminstancesCapturePostReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, nil, err - } - switch value := result.(type) { - case *PcloudPvminstancesCapturePostOK: - return value, nil, nil - case *PcloudPvminstancesCapturePostAccepted: - return nil, value, nil - } - return nil, nil, nil - -} - -/* -PcloudPvminstancesClonePost clones a p VM instance -*/ -func (a *Client) PcloudPvminstancesClonePost(params *PcloudPvminstancesClonePostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudPvminstancesClonePostAccepted, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudPvminstancesClonePostParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.pvminstances.clone.post", - Method: "POST", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/clone", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudPvminstancesClonePostReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudPvminstancesClonePostAccepted), nil - -} - -/* -PcloudPvminstancesConsoleGet lists all console languages -*/ -func (a *Client) PcloudPvminstancesConsoleGet(params *PcloudPvminstancesConsoleGetParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudPvminstancesConsoleGetOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudPvminstancesConsoleGetParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.pvminstances.console.get", - Method: "GET", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/console", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudPvminstancesConsoleGetReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudPvminstancesConsoleGetOK), nil - -} - -/* -PcloudPvminstancesConsolePost generates the no v n c console URL -*/ -func (a *Client) PcloudPvminstancesConsolePost(params *PcloudPvminstancesConsolePostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudPvminstancesConsolePostCreated, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudPvminstancesConsolePostParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.pvminstances.console.post", - Method: "POST", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/console", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudPvminstancesConsolePostReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudPvminstancesConsolePostCreated), nil - -} - -/* -PcloudPvminstancesConsolePut updates p VM instance console laguage code -*/ -func (a *Client) PcloudPvminstancesConsolePut(params *PcloudPvminstancesConsolePutParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudPvminstancesConsolePutOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudPvminstancesConsolePutParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.pvminstances.console.put", - Method: "PUT", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/console", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudPvminstancesConsolePutReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudPvminstancesConsolePutOK), nil - -} - -/* -PcloudPvminstancesDelete deletes a p cloud p VM instance -*/ -func (a *Client) PcloudPvminstancesDelete(params *PcloudPvminstancesDeleteParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudPvminstancesDeleteOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudPvminstancesDeleteParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.pvminstances.delete", - Method: "DELETE", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudPvminstancesDeleteReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudPvminstancesDeleteOK), nil - -} - -/* -PcloudPvminstancesGet gets a p VM instance s current state information -*/ -func (a *Client) PcloudPvminstancesGet(params *PcloudPvminstancesGetParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudPvminstancesGetOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudPvminstancesGetParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.pvminstances.get", - Method: "GET", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudPvminstancesGetReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudPvminstancesGetOK), nil - -} - -/* -PcloudPvminstancesGetall gets all the pvm instances for this cloud instance -*/ -func (a *Client) PcloudPvminstancesGetall(params *PcloudPvminstancesGetallParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudPvminstancesGetallOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudPvminstancesGetallParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.pvminstances.getall", - Method: "GET", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudPvminstancesGetallReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudPvminstancesGetallOK), nil - -} - -/* -PcloudPvminstancesNetworksDelete removes all address of network from a p VM instance -*/ -func (a *Client) PcloudPvminstancesNetworksDelete(params *PcloudPvminstancesNetworksDeleteParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudPvminstancesNetworksDeleteOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudPvminstancesNetworksDeleteParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.pvminstances.networks.delete", - Method: "DELETE", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks/{network_id}", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudPvminstancesNetworksDeleteReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudPvminstancesNetworksDeleteOK), nil - -} - -/* -PcloudPvminstancesNetworksGet gets a p VM instance s network information -*/ -func (a *Client) PcloudPvminstancesNetworksGet(params *PcloudPvminstancesNetworksGetParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudPvminstancesNetworksGetOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudPvminstancesNetworksGetParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.pvminstances.networks.get", - Method: "GET", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks/{network_id}", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudPvminstancesNetworksGetReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudPvminstancesNetworksGetOK), nil - -} - -/* -PcloudPvminstancesNetworksGetall gets all networks for this p VM instance -*/ -func (a *Client) PcloudPvminstancesNetworksGetall(params *PcloudPvminstancesNetworksGetallParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudPvminstancesNetworksGetallOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudPvminstancesNetworksGetallParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.pvminstances.networks.getall", - Method: "GET", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudPvminstancesNetworksGetallReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudPvminstancesNetworksGetallOK), nil - -} - -/* -PcloudPvminstancesNetworksPost performs network addition -*/ -func (a *Client) PcloudPvminstancesNetworksPost(params *PcloudPvminstancesNetworksPostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudPvminstancesNetworksPostCreated, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudPvminstancesNetworksPostParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.pvminstances.networks.post", - Method: "POST", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudPvminstancesNetworksPostReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudPvminstancesNetworksPostCreated), nil - -} - -/* -PcloudPvminstancesOperationsPost performs an operation on a p VM instance -*/ -func (a *Client) PcloudPvminstancesOperationsPost(params *PcloudPvminstancesOperationsPostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudPvminstancesOperationsPostOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudPvminstancesOperationsPostParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.pvminstances.operations.post", - Method: "POST", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/operations", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudPvminstancesOperationsPostReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudPvminstancesOperationsPostOK), nil - -} - -/* -PcloudPvminstancesPost creates a new power VM instance -*/ -func (a *Client) PcloudPvminstancesPost(params *PcloudPvminstancesPostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudPvminstancesPostOK, *PcloudPvminstancesPostCreated, *PcloudPvminstancesPostAccepted, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudPvminstancesPostParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.pvminstances.post", - Method: "POST", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudPvminstancesPostReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, nil, nil, err - } - switch value := result.(type) { - case *PcloudPvminstancesPostOK: - return value, nil, nil, nil - case *PcloudPvminstancesPostCreated: - return nil, value, nil, nil - case *PcloudPvminstancesPostAccepted: - return nil, nil, value, nil - } - return nil, nil, nil, nil - -} - -/* -PcloudPvminstancesPut updates a p cloud p VM instance -*/ -func (a *Client) PcloudPvminstancesPut(params *PcloudPvminstancesPutParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudPvminstancesPutAccepted, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudPvminstancesPutParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.pvminstances.put", - Method: "PUT", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudPvminstancesPutReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudPvminstancesPutAccepted), nil - -} - -/* -PcloudPvminstancesSnapshotsGetall gets all snapshots for this p VM instance -*/ -func (a *Client) PcloudPvminstancesSnapshotsGetall(params *PcloudPvminstancesSnapshotsGetallParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudPvminstancesSnapshotsGetallOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudPvminstancesSnapshotsGetallParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.pvminstances.snapshots.getall", - Method: "GET", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudPvminstancesSnapshotsGetallReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudPvminstancesSnapshotsGetallOK), nil - -} - -/* -PcloudPvminstancesSnapshotsPost creates a p VM instance snapshot -*/ -func (a *Client) PcloudPvminstancesSnapshotsPost(params *PcloudPvminstancesSnapshotsPostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudPvminstancesSnapshotsPostAccepted, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudPvminstancesSnapshotsPostParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.pvminstances.snapshots.post", - Method: "POST", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudPvminstancesSnapshotsPostReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudPvminstancesSnapshotsPostAccepted), nil - -} - -/* -PcloudPvminstancesSnapshotsRestorePost restores a p VM instance snapshot -*/ -func (a *Client) PcloudPvminstancesSnapshotsRestorePost(params *PcloudPvminstancesSnapshotsRestorePostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudPvminstancesSnapshotsRestorePostAccepted, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudPvminstancesSnapshotsRestorePostParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.pvminstances.snapshots.restore.post", - Method: "POST", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots/{snapshot_id}/restore", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudPvminstancesSnapshotsRestorePostReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudPvminstancesSnapshotsRestorePostAccepted), nil - -} - -/* -PcloudV2PvminstancesCaptureGet gets detail of last capture job -*/ -func (a *Client) PcloudV2PvminstancesCaptureGet(params *PcloudV2PvminstancesCaptureGetParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudV2PvminstancesCaptureGetOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudV2PvminstancesCaptureGetParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.v2.pvminstances.capture.get", - Method: "GET", - PathPattern: "/pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudV2PvminstancesCaptureGetReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudV2PvminstancesCaptureGetOK), nil - -} - -/* -PcloudV2PvminstancesCapturePost adds a capture pvm instance to the jobs queue -*/ -func (a *Client) PcloudV2PvminstancesCapturePost(params *PcloudV2PvminstancesCapturePostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudV2PvminstancesCapturePostAccepted, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudV2PvminstancesCapturePostParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.v2.pvminstances.capture.post", - Method: "POST", - PathPattern: "/pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudV2PvminstancesCapturePostReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudV2PvminstancesCapturePostAccepted), nil - -} - -// SetTransport changes the transport on the client -func (a *Client) SetTransport(transport runtime.ClientTransport) { - a.transport = transport -} diff --git a/power/client/p_cloud_p_vm_instances/p_cloudp_vm_instances_client.go b/power/client/p_cloud_p_vm_instances/p_cloudp_vm_instances_client.go new file mode 100644 index 00000000..4e52d968 --- /dev/null +++ b/power/client/p_cloud_p_vm_instances/p_cloudp_vm_instances_client.go @@ -0,0 +1,904 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// New creates a new p cloud p vm instances API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for p cloud p vm instances API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudPvminstancesActionPost(params *PcloudPvminstancesActionPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesActionPostOK, error) + + PcloudPvminstancesCapturePost(params *PcloudPvminstancesCapturePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesCapturePostOK, *PcloudPvminstancesCapturePostAccepted, error) + + PcloudPvminstancesClonePost(params *PcloudPvminstancesClonePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesClonePostAccepted, error) + + PcloudPvminstancesConsoleGet(params *PcloudPvminstancesConsoleGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesConsoleGetOK, error) + + PcloudPvminstancesConsolePost(params *PcloudPvminstancesConsolePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesConsolePostCreated, error) + + PcloudPvminstancesConsolePut(params *PcloudPvminstancesConsolePutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesConsolePutOK, error) + + PcloudPvminstancesDelete(params *PcloudPvminstancesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesDeleteOK, error) + + PcloudPvminstancesGet(params *PcloudPvminstancesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesGetOK, error) + + PcloudPvminstancesGetall(params *PcloudPvminstancesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesGetallOK, error) + + PcloudPvminstancesNetworksDelete(params *PcloudPvminstancesNetworksDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesNetworksDeleteOK, error) + + PcloudPvminstancesNetworksGet(params *PcloudPvminstancesNetworksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesNetworksGetOK, error) + + PcloudPvminstancesNetworksGetall(params *PcloudPvminstancesNetworksGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesNetworksGetallOK, error) + + PcloudPvminstancesNetworksPost(params *PcloudPvminstancesNetworksPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesNetworksPostCreated, error) + + PcloudPvminstancesOperationsPost(params *PcloudPvminstancesOperationsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesOperationsPostOK, error) + + PcloudPvminstancesPost(params *PcloudPvminstancesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesPostOK, *PcloudPvminstancesPostCreated, *PcloudPvminstancesPostAccepted, error) + + PcloudPvminstancesPut(params *PcloudPvminstancesPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesPutAccepted, error) + + PcloudPvminstancesSnapshotsGetall(params *PcloudPvminstancesSnapshotsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesSnapshotsGetallOK, error) + + PcloudPvminstancesSnapshotsPost(params *PcloudPvminstancesSnapshotsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesSnapshotsPostAccepted, error) + + PcloudPvminstancesSnapshotsRestorePost(params *PcloudPvminstancesSnapshotsRestorePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesSnapshotsRestorePostAccepted, error) + + PcloudV2PvminstancesCaptureGet(params *PcloudV2PvminstancesCaptureGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2PvminstancesCaptureGetOK, error) + + PcloudV2PvminstancesCapturePost(params *PcloudV2PvminstancesCapturePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2PvminstancesCapturePostAccepted, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + PcloudPvminstancesActionPost performs an action start stop reboot immediate shutdown reset on a p VM instance +*/ +func (a *Client) PcloudPvminstancesActionPost(params *PcloudPvminstancesActionPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesActionPostOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesActionPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.action.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/action", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesActionPostReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudPvminstancesActionPostOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.pvminstances.action.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesCapturePost captures a p VM instance and create a deployable image +*/ +func (a *Client) PcloudPvminstancesCapturePost(params *PcloudPvminstancesCapturePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesCapturePostOK, *PcloudPvminstancesCapturePostAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesCapturePostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.capture.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesCapturePostReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, nil, err + } + switch value := result.(type) { + case *PcloudPvminstancesCapturePostOK: + return value, nil, nil + case *PcloudPvminstancesCapturePostAccepted: + return nil, value, nil + } + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for p_cloud_p_vm_instances: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesClonePost clones a p VM instance +*/ +func (a *Client) PcloudPvminstancesClonePost(params *PcloudPvminstancesClonePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesClonePostAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesClonePostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.clone.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/clone", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesClonePostReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudPvminstancesClonePostAccepted) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.pvminstances.clone.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesConsoleGet lists all console languages +*/ +func (a *Client) PcloudPvminstancesConsoleGet(params *PcloudPvminstancesConsoleGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesConsoleGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesConsoleGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.console.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/console", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesConsoleGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudPvminstancesConsoleGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.pvminstances.console.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesConsolePost generates the no v n c console URL +*/ +func (a *Client) PcloudPvminstancesConsolePost(params *PcloudPvminstancesConsolePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesConsolePostCreated, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesConsolePostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.console.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/console", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesConsolePostReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudPvminstancesConsolePostCreated) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.pvminstances.console.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesConsolePut updates p VM instance console laguage code +*/ +func (a *Client) PcloudPvminstancesConsolePut(params *PcloudPvminstancesConsolePutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesConsolePutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesConsolePutParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.console.put", + Method: "PUT", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/console", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesConsolePutReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudPvminstancesConsolePutOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.pvminstances.console.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesDelete deletes a p cloud p VM instance +*/ +func (a *Client) PcloudPvminstancesDelete(params *PcloudPvminstancesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.delete", + Method: "DELETE", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudPvminstancesDeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.pvminstances.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesGet gets a p VM instance s current state information +*/ +func (a *Client) PcloudPvminstancesGet(params *PcloudPvminstancesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudPvminstancesGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.pvminstances.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesGetall gets all the pvm instances for this cloud instance +*/ +func (a *Client) PcloudPvminstancesGetall(params *PcloudPvminstancesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.getall", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesGetallReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudPvminstancesGetallOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.pvminstances.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesNetworksDelete removes all address of network from a p VM instance +*/ +func (a *Client) PcloudPvminstancesNetworksDelete(params *PcloudPvminstancesNetworksDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesNetworksDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesNetworksDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.networks.delete", + Method: "DELETE", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks/{network_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesNetworksDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudPvminstancesNetworksDeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.pvminstances.networks.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesNetworksGet gets a p VM instance s network information +*/ +func (a *Client) PcloudPvminstancesNetworksGet(params *PcloudPvminstancesNetworksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesNetworksGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesNetworksGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.networks.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks/{network_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesNetworksGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudPvminstancesNetworksGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.pvminstances.networks.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesNetworksGetall gets all networks for this p VM instance +*/ +func (a *Client) PcloudPvminstancesNetworksGetall(params *PcloudPvminstancesNetworksGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesNetworksGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesNetworksGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.networks.getall", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesNetworksGetallReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudPvminstancesNetworksGetallOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.pvminstances.networks.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesNetworksPost performs network addition +*/ +func (a *Client) PcloudPvminstancesNetworksPost(params *PcloudPvminstancesNetworksPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesNetworksPostCreated, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesNetworksPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.networks.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesNetworksPostReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudPvminstancesNetworksPostCreated) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.pvminstances.networks.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesOperationsPost performs an operation on a p VM instance +*/ +func (a *Client) PcloudPvminstancesOperationsPost(params *PcloudPvminstancesOperationsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesOperationsPostOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesOperationsPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.operations.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/operations", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesOperationsPostReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudPvminstancesOperationsPostOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.pvminstances.operations.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesPost creates a new power VM instance +*/ +func (a *Client) PcloudPvminstancesPost(params *PcloudPvminstancesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesPostOK, *PcloudPvminstancesPostCreated, *PcloudPvminstancesPostAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesPostReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, nil, nil, err + } + switch value := result.(type) { + case *PcloudPvminstancesPostOK: + return value, nil, nil, nil + case *PcloudPvminstancesPostCreated: + return nil, value, nil, nil + case *PcloudPvminstancesPostAccepted: + return nil, nil, value, nil + } + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for p_cloud_p_vm_instances: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesPut updates a p cloud p VM instance +*/ +func (a *Client) PcloudPvminstancesPut(params *PcloudPvminstancesPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesPutAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesPutParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.put", + Method: "PUT", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesPutReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudPvminstancesPutAccepted) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.pvminstances.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesSnapshotsGetall gets all snapshots for this p VM instance +*/ +func (a *Client) PcloudPvminstancesSnapshotsGetall(params *PcloudPvminstancesSnapshotsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesSnapshotsGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesSnapshotsGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.snapshots.getall", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesSnapshotsGetallReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudPvminstancesSnapshotsGetallOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.pvminstances.snapshots.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesSnapshotsPost creates a p VM instance snapshot +*/ +func (a *Client) PcloudPvminstancesSnapshotsPost(params *PcloudPvminstancesSnapshotsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesSnapshotsPostAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesSnapshotsPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.snapshots.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesSnapshotsPostReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudPvminstancesSnapshotsPostAccepted) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.pvminstances.snapshots.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesSnapshotsRestorePost restores a p VM instance snapshot +*/ +func (a *Client) PcloudPvminstancesSnapshotsRestorePost(params *PcloudPvminstancesSnapshotsRestorePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesSnapshotsRestorePostAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesSnapshotsRestorePostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.snapshots.restore.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots/{snapshot_id}/restore", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesSnapshotsRestorePostReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudPvminstancesSnapshotsRestorePostAccepted) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.pvminstances.snapshots.restore.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudV2PvminstancesCaptureGet gets detail of last capture job +*/ +func (a *Client) PcloudV2PvminstancesCaptureGet(params *PcloudV2PvminstancesCaptureGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2PvminstancesCaptureGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudV2PvminstancesCaptureGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.v2.pvminstances.capture.get", + Method: "GET", + PathPattern: "/pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudV2PvminstancesCaptureGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudV2PvminstancesCaptureGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.v2.pvminstances.capture.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudV2PvminstancesCapturePost adds a capture pvm instance to the jobs queue +*/ +func (a *Client) PcloudV2PvminstancesCapturePost(params *PcloudV2PvminstancesCapturePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2PvminstancesCapturePostAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudV2PvminstancesCapturePostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.v2.pvminstances.capture.post", + Method: "POST", + PathPattern: "/pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudV2PvminstancesCapturePostReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudV2PvminstancesCapturePostAccepted) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.v2.pvminstances.capture.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_action_post_parameters.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_action_post_parameters.go index bcff9169..27ae8aa3 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_action_post_parameters.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_action_post_parameters.go @@ -13,69 +13,69 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudPvminstancesActionPostParams creates a new PcloudPvminstancesActionPostParams object -// with the default values initialized. +// NewPcloudPvminstancesActionPostParams creates a new PcloudPvminstancesActionPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudPvminstancesActionPostParams() *PcloudPvminstancesActionPostParams { - var () return &PcloudPvminstancesActionPostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudPvminstancesActionPostParamsWithTimeout creates a new PcloudPvminstancesActionPostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudPvminstancesActionPostParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesActionPostParams { - var () return &PcloudPvminstancesActionPostParams{ - timeout: timeout, } } // NewPcloudPvminstancesActionPostParamsWithContext creates a new PcloudPvminstancesActionPostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudPvminstancesActionPostParamsWithContext(ctx context.Context) *PcloudPvminstancesActionPostParams { - var () return &PcloudPvminstancesActionPostParams{ - Context: ctx, } } // NewPcloudPvminstancesActionPostParamsWithHTTPClient creates a new PcloudPvminstancesActionPostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudPvminstancesActionPostParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesActionPostParams { - var () return &PcloudPvminstancesActionPostParams{ HTTPClient: client, } } -/*PcloudPvminstancesActionPostParams contains all the parameters to send to the API endpoint -for the pcloud pvminstances action post operation typically these are written to a http.Request +/* PcloudPvminstancesActionPostParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances action post operation. + + Typically these are written to a http.Request. */ type PcloudPvminstancesActionPostParams struct { - /*Body - Parameters for the desired action + /* Body. + Parameters for the desired action */ Body *models.PVMInstanceAction - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*PvmInstanceID - PCloud PVM Instance ID + /* PvmInstanceID. + + PCloud PVM Instance ID */ PvmInstanceID string @@ -84,6 +84,21 @@ type PcloudPvminstancesActionPostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud pvminstances action post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesActionPostParams) WithDefaults() *PcloudPvminstancesActionPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances action post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesActionPostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud pvminstances action post params func (o *PcloudPvminstancesActionPostParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesActionPostParams { o.SetTimeout(timeout) @@ -157,7 +172,6 @@ func (o *PcloudPvminstancesActionPostParams) WriteToRequest(r runtime.ClientRequ return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_action_post_responses.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_action_post_responses.go index 71091752..3f0e3a3f 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_action_post_responses.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_action_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudPvminstancesActionPostReader is a Reader for the PcloudPvminstancesActionPost structure. @@ -24,44 +23,38 @@ type PcloudPvminstancesActionPostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudPvminstancesActionPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudPvminstancesActionPostOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudPvminstancesActionPostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudPvminstancesActionPostUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudPvminstancesActionPostNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudPvminstancesActionPostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudPvminstancesActionPostOK() *PcloudPvminstancesActionPostOK { return &PcloudPvminstancesActionPostOK{} } -/*PcloudPvminstancesActionPostOK handles this case with default header values. +/* PcloudPvminstancesActionPostOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudPvminstancesActionPostOK struct { func (o *PcloudPvminstancesActionPostOK) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/action][%d] pcloudPvminstancesActionPostOK %+v", 200, o.Payload) } +func (o *PcloudPvminstancesActionPostOK) GetPayload() models.Object { + return o.Payload +} func (o *PcloudPvminstancesActionPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -97,7 +93,7 @@ func NewPcloudPvminstancesActionPostBadRequest() *PcloudPvminstancesActionPostBa return &PcloudPvminstancesActionPostBadRequest{} } -/*PcloudPvminstancesActionPostBadRequest handles this case with default header values. +/* PcloudPvminstancesActionPostBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -108,6 +104,9 @@ type PcloudPvminstancesActionPostBadRequest struct { func (o *PcloudPvminstancesActionPostBadRequest) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/action][%d] pcloudPvminstancesActionPostBadRequest %+v", 400, o.Payload) } +func (o *PcloudPvminstancesActionPostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesActionPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -126,7 +125,7 @@ func NewPcloudPvminstancesActionPostUnauthorized() *PcloudPvminstancesActionPost return &PcloudPvminstancesActionPostUnauthorized{} } -/*PcloudPvminstancesActionPostUnauthorized handles this case with default header values. +/* PcloudPvminstancesActionPostUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -137,6 +136,9 @@ type PcloudPvminstancesActionPostUnauthorized struct { func (o *PcloudPvminstancesActionPostUnauthorized) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/action][%d] pcloudPvminstancesActionPostUnauthorized %+v", 401, o.Payload) } +func (o *PcloudPvminstancesActionPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesActionPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -155,7 +157,7 @@ func NewPcloudPvminstancesActionPostNotFound() *PcloudPvminstancesActionPostNotF return &PcloudPvminstancesActionPostNotFound{} } -/*PcloudPvminstancesActionPostNotFound handles this case with default header values. +/* PcloudPvminstancesActionPostNotFound describes a response with status code 404, with default header values. Not Found */ @@ -166,6 +168,9 @@ type PcloudPvminstancesActionPostNotFound struct { func (o *PcloudPvminstancesActionPostNotFound) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/action][%d] pcloudPvminstancesActionPostNotFound %+v", 404, o.Payload) } +func (o *PcloudPvminstancesActionPostNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesActionPostNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -184,7 +189,7 @@ func NewPcloudPvminstancesActionPostInternalServerError() *PcloudPvminstancesAct return &PcloudPvminstancesActionPostInternalServerError{} } -/*PcloudPvminstancesActionPostInternalServerError handles this case with default header values. +/* PcloudPvminstancesActionPostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -195,6 +200,9 @@ type PcloudPvminstancesActionPostInternalServerError struct { func (o *PcloudPvminstancesActionPostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/action][%d] pcloudPvminstancesActionPostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudPvminstancesActionPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesActionPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_capture_post_parameters.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_capture_post_parameters.go index 1a73c209..501695e6 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_capture_post_parameters.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_capture_post_parameters.go @@ -13,69 +13,69 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudPvminstancesCapturePostParams creates a new PcloudPvminstancesCapturePostParams object -// with the default values initialized. +// NewPcloudPvminstancesCapturePostParams creates a new PcloudPvminstancesCapturePostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudPvminstancesCapturePostParams() *PcloudPvminstancesCapturePostParams { - var () return &PcloudPvminstancesCapturePostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudPvminstancesCapturePostParamsWithTimeout creates a new PcloudPvminstancesCapturePostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudPvminstancesCapturePostParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesCapturePostParams { - var () return &PcloudPvminstancesCapturePostParams{ - timeout: timeout, } } // NewPcloudPvminstancesCapturePostParamsWithContext creates a new PcloudPvminstancesCapturePostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudPvminstancesCapturePostParamsWithContext(ctx context.Context) *PcloudPvminstancesCapturePostParams { - var () return &PcloudPvminstancesCapturePostParams{ - Context: ctx, } } // NewPcloudPvminstancesCapturePostParamsWithHTTPClient creates a new PcloudPvminstancesCapturePostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudPvminstancesCapturePostParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesCapturePostParams { - var () return &PcloudPvminstancesCapturePostParams{ HTTPClient: client, } } -/*PcloudPvminstancesCapturePostParams contains all the parameters to send to the API endpoint -for the pcloud pvminstances capture post operation typically these are written to a http.Request +/* PcloudPvminstancesCapturePostParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances capture post operation. + + Typically these are written to a http.Request. */ type PcloudPvminstancesCapturePostParams struct { - /*Body - Parameters for the capture PVMInstance + /* Body. + Parameters for the capture PVMInstance */ Body *models.PVMInstanceCapture - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*PvmInstanceID - PCloud PVM Instance ID + /* PvmInstanceID. + + PCloud PVM Instance ID */ PvmInstanceID string @@ -84,6 +84,21 @@ type PcloudPvminstancesCapturePostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud pvminstances capture post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesCapturePostParams) WithDefaults() *PcloudPvminstancesCapturePostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances capture post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesCapturePostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud pvminstances capture post params func (o *PcloudPvminstancesCapturePostParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesCapturePostParams { o.SetTimeout(timeout) @@ -157,7 +172,6 @@ func (o *PcloudPvminstancesCapturePostParams) WriteToRequest(r runtime.ClientReq return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_capture_post_responses.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_capture_post_responses.go index 3675f54a..436187f5 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_capture_post_responses.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_capture_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudPvminstancesCapturePostReader is a Reader for the PcloudPvminstancesCapturePost structure. @@ -24,51 +23,44 @@ type PcloudPvminstancesCapturePostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudPvminstancesCapturePostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudPvminstancesCapturePostOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 202: result := NewPcloudPvminstancesCapturePostAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudPvminstancesCapturePostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudPvminstancesCapturePostUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudPvminstancesCapturePostUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudPvminstancesCapturePostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -77,7 +69,7 @@ func NewPcloudPvminstancesCapturePostOK() *PcloudPvminstancesCapturePostOK { return &PcloudPvminstancesCapturePostOK{} } -/*PcloudPvminstancesCapturePostOK handles this case with default header values. +/* PcloudPvminstancesCapturePostOK describes a response with status code 200, with default header values. OK */ @@ -88,6 +80,9 @@ type PcloudPvminstancesCapturePostOK struct { func (o *PcloudPvminstancesCapturePostOK) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture][%d] pcloudPvminstancesCapturePostOK %+v", 200, o.Payload) } +func (o *PcloudPvminstancesCapturePostOK) GetPayload() models.Object { + return o.Payload +} func (o *PcloudPvminstancesCapturePostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -104,7 +99,7 @@ func NewPcloudPvminstancesCapturePostAccepted() *PcloudPvminstancesCapturePostAc return &PcloudPvminstancesCapturePostAccepted{} } -/*PcloudPvminstancesCapturePostAccepted handles this case with default header values. +/* PcloudPvminstancesCapturePostAccepted describes a response with status code 202, with default header values. Accepted, upload to cloud storage in progress */ @@ -115,6 +110,9 @@ type PcloudPvminstancesCapturePostAccepted struct { func (o *PcloudPvminstancesCapturePostAccepted) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture][%d] pcloudPvminstancesCapturePostAccepted %+v", 202, o.Payload) } +func (o *PcloudPvminstancesCapturePostAccepted) GetPayload() models.Object { + return o.Payload +} func (o *PcloudPvminstancesCapturePostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -131,7 +129,7 @@ func NewPcloudPvminstancesCapturePostBadRequest() *PcloudPvminstancesCapturePost return &PcloudPvminstancesCapturePostBadRequest{} } -/*PcloudPvminstancesCapturePostBadRequest handles this case with default header values. +/* PcloudPvminstancesCapturePostBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -142,6 +140,9 @@ type PcloudPvminstancesCapturePostBadRequest struct { func (o *PcloudPvminstancesCapturePostBadRequest) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture][%d] pcloudPvminstancesCapturePostBadRequest %+v", 400, o.Payload) } +func (o *PcloudPvminstancesCapturePostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesCapturePostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -160,7 +161,7 @@ func NewPcloudPvminstancesCapturePostUnauthorized() *PcloudPvminstancesCapturePo return &PcloudPvminstancesCapturePostUnauthorized{} } -/*PcloudPvminstancesCapturePostUnauthorized handles this case with default header values. +/* PcloudPvminstancesCapturePostUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -171,6 +172,9 @@ type PcloudPvminstancesCapturePostUnauthorized struct { func (o *PcloudPvminstancesCapturePostUnauthorized) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture][%d] pcloudPvminstancesCapturePostUnauthorized %+v", 401, o.Payload) } +func (o *PcloudPvminstancesCapturePostUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesCapturePostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -189,7 +193,7 @@ func NewPcloudPvminstancesCapturePostUnprocessableEntity() *PcloudPvminstancesCa return &PcloudPvminstancesCapturePostUnprocessableEntity{} } -/*PcloudPvminstancesCapturePostUnprocessableEntity handles this case with default header values. +/* PcloudPvminstancesCapturePostUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -200,6 +204,9 @@ type PcloudPvminstancesCapturePostUnprocessableEntity struct { func (o *PcloudPvminstancesCapturePostUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture][%d] pcloudPvminstancesCapturePostUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudPvminstancesCapturePostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesCapturePostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -218,7 +225,7 @@ func NewPcloudPvminstancesCapturePostInternalServerError() *PcloudPvminstancesCa return &PcloudPvminstancesCapturePostInternalServerError{} } -/*PcloudPvminstancesCapturePostInternalServerError handles this case with default header values. +/* PcloudPvminstancesCapturePostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -229,6 +236,9 @@ type PcloudPvminstancesCapturePostInternalServerError struct { func (o *PcloudPvminstancesCapturePostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture][%d] pcloudPvminstancesCapturePostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudPvminstancesCapturePostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesCapturePostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_clone_post_parameters.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_clone_post_parameters.go index 9c5e86bf..b51625f4 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_clone_post_parameters.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_clone_post_parameters.go @@ -13,69 +13,69 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudPvminstancesClonePostParams creates a new PcloudPvminstancesClonePostParams object -// with the default values initialized. +// NewPcloudPvminstancesClonePostParams creates a new PcloudPvminstancesClonePostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudPvminstancesClonePostParams() *PcloudPvminstancesClonePostParams { - var () return &PcloudPvminstancesClonePostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudPvminstancesClonePostParamsWithTimeout creates a new PcloudPvminstancesClonePostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudPvminstancesClonePostParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesClonePostParams { - var () return &PcloudPvminstancesClonePostParams{ - timeout: timeout, } } // NewPcloudPvminstancesClonePostParamsWithContext creates a new PcloudPvminstancesClonePostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudPvminstancesClonePostParamsWithContext(ctx context.Context) *PcloudPvminstancesClonePostParams { - var () return &PcloudPvminstancesClonePostParams{ - Context: ctx, } } // NewPcloudPvminstancesClonePostParamsWithHTTPClient creates a new PcloudPvminstancesClonePostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudPvminstancesClonePostParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesClonePostParams { - var () return &PcloudPvminstancesClonePostParams{ HTTPClient: client, } } -/*PcloudPvminstancesClonePostParams contains all the parameters to send to the API endpoint -for the pcloud pvminstances clone post operation typically these are written to a http.Request +/* PcloudPvminstancesClonePostParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances clone post operation. + + Typically these are written to a http.Request. */ type PcloudPvminstancesClonePostParams struct { - /*Body - Clone PVM Instance parameters + /* Body. + Clone PVM Instance parameters */ Body *models.PVMInstanceClone - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*PvmInstanceID - PCloud PVM Instance ID + /* PvmInstanceID. + + PCloud PVM Instance ID */ PvmInstanceID string @@ -84,6 +84,21 @@ type PcloudPvminstancesClonePostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud pvminstances clone post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesClonePostParams) WithDefaults() *PcloudPvminstancesClonePostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances clone post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesClonePostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud pvminstances clone post params func (o *PcloudPvminstancesClonePostParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesClonePostParams { o.SetTimeout(timeout) @@ -157,7 +172,6 @@ func (o *PcloudPvminstancesClonePostParams) WriteToRequest(r runtime.ClientReque return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_clone_post_responses.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_clone_post_responses.go index b1933405..4d4e0510 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_clone_post_responses.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_clone_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudPvminstancesClonePostReader is a Reader for the PcloudPvminstancesClonePost structure. @@ -24,51 +23,44 @@ type PcloudPvminstancesClonePostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudPvminstancesClonePostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 202: result := NewPcloudPvminstancesClonePostAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudPvminstancesClonePostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudPvminstancesClonePostUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 409: result := NewPcloudPvminstancesClonePostConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudPvminstancesClonePostUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudPvminstancesClonePostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -77,7 +69,7 @@ func NewPcloudPvminstancesClonePostAccepted() *PcloudPvminstancesClonePostAccept return &PcloudPvminstancesClonePostAccepted{} } -/*PcloudPvminstancesClonePostAccepted handles this case with default header values. +/* PcloudPvminstancesClonePostAccepted describes a response with status code 202, with default header values. Accepted */ @@ -88,6 +80,9 @@ type PcloudPvminstancesClonePostAccepted struct { func (o *PcloudPvminstancesClonePostAccepted) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/clone][%d] pcloudPvminstancesClonePostAccepted %+v", 202, o.Payload) } +func (o *PcloudPvminstancesClonePostAccepted) GetPayload() *models.PVMInstance { + return o.Payload +} func (o *PcloudPvminstancesClonePostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -106,7 +101,7 @@ func NewPcloudPvminstancesClonePostBadRequest() *PcloudPvminstancesClonePostBadR return &PcloudPvminstancesClonePostBadRequest{} } -/*PcloudPvminstancesClonePostBadRequest handles this case with default header values. +/* PcloudPvminstancesClonePostBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -117,6 +112,9 @@ type PcloudPvminstancesClonePostBadRequest struct { func (o *PcloudPvminstancesClonePostBadRequest) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/clone][%d] pcloudPvminstancesClonePostBadRequest %+v", 400, o.Payload) } +func (o *PcloudPvminstancesClonePostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesClonePostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -135,7 +133,7 @@ func NewPcloudPvminstancesClonePostUnauthorized() *PcloudPvminstancesClonePostUn return &PcloudPvminstancesClonePostUnauthorized{} } -/*PcloudPvminstancesClonePostUnauthorized handles this case with default header values. +/* PcloudPvminstancesClonePostUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -146,6 +144,9 @@ type PcloudPvminstancesClonePostUnauthorized struct { func (o *PcloudPvminstancesClonePostUnauthorized) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/clone][%d] pcloudPvminstancesClonePostUnauthorized %+v", 401, o.Payload) } +func (o *PcloudPvminstancesClonePostUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesClonePostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -164,7 +165,7 @@ func NewPcloudPvminstancesClonePostConflict() *PcloudPvminstancesClonePostConfli return &PcloudPvminstancesClonePostConflict{} } -/*PcloudPvminstancesClonePostConflict handles this case with default header values. +/* PcloudPvminstancesClonePostConflict describes a response with status code 409, with default header values. Conflict */ @@ -175,6 +176,9 @@ type PcloudPvminstancesClonePostConflict struct { func (o *PcloudPvminstancesClonePostConflict) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/clone][%d] pcloudPvminstancesClonePostConflict %+v", 409, o.Payload) } +func (o *PcloudPvminstancesClonePostConflict) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesClonePostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -193,7 +197,7 @@ func NewPcloudPvminstancesClonePostUnprocessableEntity() *PcloudPvminstancesClon return &PcloudPvminstancesClonePostUnprocessableEntity{} } -/*PcloudPvminstancesClonePostUnprocessableEntity handles this case with default header values. +/* PcloudPvminstancesClonePostUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -204,6 +208,9 @@ type PcloudPvminstancesClonePostUnprocessableEntity struct { func (o *PcloudPvminstancesClonePostUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/clone][%d] pcloudPvminstancesClonePostUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudPvminstancesClonePostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesClonePostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -222,7 +229,7 @@ func NewPcloudPvminstancesClonePostInternalServerError() *PcloudPvminstancesClon return &PcloudPvminstancesClonePostInternalServerError{} } -/*PcloudPvminstancesClonePostInternalServerError handles this case with default header values. +/* PcloudPvminstancesClonePostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -233,6 +240,9 @@ type PcloudPvminstancesClonePostInternalServerError struct { func (o *PcloudPvminstancesClonePostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/clone][%d] pcloudPvminstancesClonePostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudPvminstancesClonePostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesClonePostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_get_parameters.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_get_parameters.go index ed846356..80d994b2 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_get_parameters.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_get_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudPvminstancesConsoleGetParams creates a new PcloudPvminstancesConsoleGetParams object -// with the default values initialized. +// NewPcloudPvminstancesConsoleGetParams creates a new PcloudPvminstancesConsoleGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudPvminstancesConsoleGetParams() *PcloudPvminstancesConsoleGetParams { - var () return &PcloudPvminstancesConsoleGetParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudPvminstancesConsoleGetParamsWithTimeout creates a new PcloudPvminstancesConsoleGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudPvminstancesConsoleGetParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesConsoleGetParams { - var () return &PcloudPvminstancesConsoleGetParams{ - timeout: timeout, } } // NewPcloudPvminstancesConsoleGetParamsWithContext creates a new PcloudPvminstancesConsoleGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudPvminstancesConsoleGetParamsWithContext(ctx context.Context) *PcloudPvminstancesConsoleGetParams { - var () return &PcloudPvminstancesConsoleGetParams{ - Context: ctx, } } // NewPcloudPvminstancesConsoleGetParamsWithHTTPClient creates a new PcloudPvminstancesConsoleGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudPvminstancesConsoleGetParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesConsoleGetParams { - var () return &PcloudPvminstancesConsoleGetParams{ HTTPClient: client, } } -/*PcloudPvminstancesConsoleGetParams contains all the parameters to send to the API endpoint -for the pcloud pvminstances console get operation typically these are written to a http.Request +/* PcloudPvminstancesConsoleGetParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances console get operation. + + Typically these are written to a http.Request. */ type PcloudPvminstancesConsoleGetParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*PvmInstanceID - PCloud PVM Instance ID + /* PvmInstanceID. + + PCloud PVM Instance ID */ PvmInstanceID string @@ -77,6 +76,21 @@ type PcloudPvminstancesConsoleGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud pvminstances console get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesConsoleGetParams) WithDefaults() *PcloudPvminstancesConsoleGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances console get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesConsoleGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud pvminstances console get params func (o *PcloudPvminstancesConsoleGetParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesConsoleGetParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_get_responses.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_get_responses.go index 1e9a8b12..1caf3498 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_get_responses.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudPvminstancesConsoleGetReader is a Reader for the PcloudPvminstancesConsoleGet structure. @@ -24,37 +23,32 @@ type PcloudPvminstancesConsoleGetReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudPvminstancesConsoleGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudPvminstancesConsoleGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudPvminstancesConsoleGetBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudPvminstancesConsoleGetUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudPvminstancesConsoleGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -63,7 +57,7 @@ func NewPcloudPvminstancesConsoleGetOK() *PcloudPvminstancesConsoleGetOK { return &PcloudPvminstancesConsoleGetOK{} } -/*PcloudPvminstancesConsoleGetOK handles this case with default header values. +/* PcloudPvminstancesConsoleGetOK describes a response with status code 200, with default header values. OK */ @@ -74,6 +68,9 @@ type PcloudPvminstancesConsoleGetOK struct { func (o *PcloudPvminstancesConsoleGetOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/console][%d] pcloudPvminstancesConsoleGetOK %+v", 200, o.Payload) } +func (o *PcloudPvminstancesConsoleGetOK) GetPayload() *models.ConsoleLanguages { + return o.Payload +} func (o *PcloudPvminstancesConsoleGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -92,7 +89,7 @@ func NewPcloudPvminstancesConsoleGetBadRequest() *PcloudPvminstancesConsoleGetBa return &PcloudPvminstancesConsoleGetBadRequest{} } -/*PcloudPvminstancesConsoleGetBadRequest handles this case with default header values. +/* PcloudPvminstancesConsoleGetBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -103,6 +100,9 @@ type PcloudPvminstancesConsoleGetBadRequest struct { func (o *PcloudPvminstancesConsoleGetBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/console][%d] pcloudPvminstancesConsoleGetBadRequest %+v", 400, o.Payload) } +func (o *PcloudPvminstancesConsoleGetBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesConsoleGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -121,7 +121,7 @@ func NewPcloudPvminstancesConsoleGetUnauthorized() *PcloudPvminstancesConsoleGet return &PcloudPvminstancesConsoleGetUnauthorized{} } -/*PcloudPvminstancesConsoleGetUnauthorized handles this case with default header values. +/* PcloudPvminstancesConsoleGetUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -132,6 +132,9 @@ type PcloudPvminstancesConsoleGetUnauthorized struct { func (o *PcloudPvminstancesConsoleGetUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/console][%d] pcloudPvminstancesConsoleGetUnauthorized %+v", 401, o.Payload) } +func (o *PcloudPvminstancesConsoleGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesConsoleGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -150,7 +153,7 @@ func NewPcloudPvminstancesConsoleGetInternalServerError() *PcloudPvminstancesCon return &PcloudPvminstancesConsoleGetInternalServerError{} } -/*PcloudPvminstancesConsoleGetInternalServerError handles this case with default header values. +/* PcloudPvminstancesConsoleGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -161,6 +164,9 @@ type PcloudPvminstancesConsoleGetInternalServerError struct { func (o *PcloudPvminstancesConsoleGetInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/console][%d] pcloudPvminstancesConsoleGetInternalServerError %+v", 500, o.Payload) } +func (o *PcloudPvminstancesConsoleGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesConsoleGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_post_parameters.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_post_parameters.go index d9611074..86a27e66 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_post_parameters.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_post_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudPvminstancesConsolePostParams creates a new PcloudPvminstancesConsolePostParams object -// with the default values initialized. +// NewPcloudPvminstancesConsolePostParams creates a new PcloudPvminstancesConsolePostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudPvminstancesConsolePostParams() *PcloudPvminstancesConsolePostParams { - var () return &PcloudPvminstancesConsolePostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudPvminstancesConsolePostParamsWithTimeout creates a new PcloudPvminstancesConsolePostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudPvminstancesConsolePostParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesConsolePostParams { - var () return &PcloudPvminstancesConsolePostParams{ - timeout: timeout, } } // NewPcloudPvminstancesConsolePostParamsWithContext creates a new PcloudPvminstancesConsolePostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudPvminstancesConsolePostParamsWithContext(ctx context.Context) *PcloudPvminstancesConsolePostParams { - var () return &PcloudPvminstancesConsolePostParams{ - Context: ctx, } } // NewPcloudPvminstancesConsolePostParamsWithHTTPClient creates a new PcloudPvminstancesConsolePostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudPvminstancesConsolePostParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesConsolePostParams { - var () return &PcloudPvminstancesConsolePostParams{ HTTPClient: client, } } -/*PcloudPvminstancesConsolePostParams contains all the parameters to send to the API endpoint -for the pcloud pvminstances console post operation typically these are written to a http.Request +/* PcloudPvminstancesConsolePostParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances console post operation. + + Typically these are written to a http.Request. */ type PcloudPvminstancesConsolePostParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*PvmInstanceID - PCloud PVM Instance ID + /* PvmInstanceID. + + PCloud PVM Instance ID */ PvmInstanceID string @@ -77,6 +76,21 @@ type PcloudPvminstancesConsolePostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud pvminstances console post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesConsolePostParams) WithDefaults() *PcloudPvminstancesConsolePostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances console post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesConsolePostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud pvminstances console post params func (o *PcloudPvminstancesConsolePostParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesConsolePostParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_post_responses.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_post_responses.go index 6a3d7c80..590e7f5b 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_post_responses.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudPvminstancesConsolePostReader is a Reader for the PcloudPvminstancesConsolePost structure. @@ -24,37 +23,32 @@ type PcloudPvminstancesConsolePostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudPvminstancesConsolePostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 201: result := NewPcloudPvminstancesConsolePostCreated() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 401: result := NewPcloudPvminstancesConsolePostUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudPvminstancesConsolePostUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudPvminstancesConsolePostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -63,7 +57,7 @@ func NewPcloudPvminstancesConsolePostCreated() *PcloudPvminstancesConsolePostCre return &PcloudPvminstancesConsolePostCreated{} } -/*PcloudPvminstancesConsolePostCreated handles this case with default header values. +/* PcloudPvminstancesConsolePostCreated describes a response with status code 201, with default header values. Created */ @@ -74,6 +68,9 @@ type PcloudPvminstancesConsolePostCreated struct { func (o *PcloudPvminstancesConsolePostCreated) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/console][%d] pcloudPvminstancesConsolePostCreated %+v", 201, o.Payload) } +func (o *PcloudPvminstancesConsolePostCreated) GetPayload() *models.PVMInstanceConsole { + return o.Payload +} func (o *PcloudPvminstancesConsolePostCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -92,7 +89,7 @@ func NewPcloudPvminstancesConsolePostUnauthorized() *PcloudPvminstancesConsolePo return &PcloudPvminstancesConsolePostUnauthorized{} } -/*PcloudPvminstancesConsolePostUnauthorized handles this case with default header values. +/* PcloudPvminstancesConsolePostUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -103,6 +100,9 @@ type PcloudPvminstancesConsolePostUnauthorized struct { func (o *PcloudPvminstancesConsolePostUnauthorized) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/console][%d] pcloudPvminstancesConsolePostUnauthorized %+v", 401, o.Payload) } +func (o *PcloudPvminstancesConsolePostUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesConsolePostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -121,7 +121,7 @@ func NewPcloudPvminstancesConsolePostUnprocessableEntity() *PcloudPvminstancesCo return &PcloudPvminstancesConsolePostUnprocessableEntity{} } -/*PcloudPvminstancesConsolePostUnprocessableEntity handles this case with default header values. +/* PcloudPvminstancesConsolePostUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -132,6 +132,9 @@ type PcloudPvminstancesConsolePostUnprocessableEntity struct { func (o *PcloudPvminstancesConsolePostUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/console][%d] pcloudPvminstancesConsolePostUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudPvminstancesConsolePostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesConsolePostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -150,7 +153,7 @@ func NewPcloudPvminstancesConsolePostInternalServerError() *PcloudPvminstancesCo return &PcloudPvminstancesConsolePostInternalServerError{} } -/*PcloudPvminstancesConsolePostInternalServerError handles this case with default header values. +/* PcloudPvminstancesConsolePostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -161,6 +164,9 @@ type PcloudPvminstancesConsolePostInternalServerError struct { func (o *PcloudPvminstancesConsolePostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/console][%d] pcloudPvminstancesConsolePostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudPvminstancesConsolePostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesConsolePostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_put_parameters.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_put_parameters.go index c30e3305..a6f70378 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_put_parameters.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_put_parameters.go @@ -13,69 +13,69 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudPvminstancesConsolePutParams creates a new PcloudPvminstancesConsolePutParams object -// with the default values initialized. +// NewPcloudPvminstancesConsolePutParams creates a new PcloudPvminstancesConsolePutParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudPvminstancesConsolePutParams() *PcloudPvminstancesConsolePutParams { - var () return &PcloudPvminstancesConsolePutParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudPvminstancesConsolePutParamsWithTimeout creates a new PcloudPvminstancesConsolePutParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudPvminstancesConsolePutParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesConsolePutParams { - var () return &PcloudPvminstancesConsolePutParams{ - timeout: timeout, } } // NewPcloudPvminstancesConsolePutParamsWithContext creates a new PcloudPvminstancesConsolePutParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudPvminstancesConsolePutParamsWithContext(ctx context.Context) *PcloudPvminstancesConsolePutParams { - var () return &PcloudPvminstancesConsolePutParams{ - Context: ctx, } } // NewPcloudPvminstancesConsolePutParamsWithHTTPClient creates a new PcloudPvminstancesConsolePutParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudPvminstancesConsolePutParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesConsolePutParams { - var () return &PcloudPvminstancesConsolePutParams{ HTTPClient: client, } } -/*PcloudPvminstancesConsolePutParams contains all the parameters to send to the API endpoint -for the pcloud pvminstances console put operation typically these are written to a http.Request +/* PcloudPvminstancesConsolePutParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances console put operation. + + Typically these are written to a http.Request. */ type PcloudPvminstancesConsolePutParams struct { - /*Body - Parameters to update a PVMInstance console required codepage + /* Body. + Parameters to update a PVMInstance console required codepage */ Body *models.ConsoleLanguage - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*PvmInstanceID - PCloud PVM Instance ID + /* PvmInstanceID. + + PCloud PVM Instance ID */ PvmInstanceID string @@ -84,6 +84,21 @@ type PcloudPvminstancesConsolePutParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud pvminstances console put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesConsolePutParams) WithDefaults() *PcloudPvminstancesConsolePutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances console put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesConsolePutParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud pvminstances console put params func (o *PcloudPvminstancesConsolePutParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesConsolePutParams { o.SetTimeout(timeout) @@ -157,7 +172,6 @@ func (o *PcloudPvminstancesConsolePutParams) WriteToRequest(r runtime.ClientRequ return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_put_responses.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_put_responses.go index 05f1356c..c3331bef 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_put_responses.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_put_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudPvminstancesConsolePutReader is a Reader for the PcloudPvminstancesConsolePut structure. @@ -24,37 +23,32 @@ type PcloudPvminstancesConsolePutReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudPvminstancesConsolePutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudPvminstancesConsolePutOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudPvminstancesConsolePutBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudPvminstancesConsolePutUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudPvminstancesConsolePutInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -63,7 +57,7 @@ func NewPcloudPvminstancesConsolePutOK() *PcloudPvminstancesConsolePutOK { return &PcloudPvminstancesConsolePutOK{} } -/*PcloudPvminstancesConsolePutOK handles this case with default header values. +/* PcloudPvminstancesConsolePutOK describes a response with status code 200, with default header values. OK */ @@ -74,6 +68,9 @@ type PcloudPvminstancesConsolePutOK struct { func (o *PcloudPvminstancesConsolePutOK) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/console][%d] pcloudPvminstancesConsolePutOK %+v", 200, o.Payload) } +func (o *PcloudPvminstancesConsolePutOK) GetPayload() *models.ConsoleLanguage { + return o.Payload +} func (o *PcloudPvminstancesConsolePutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -92,7 +89,7 @@ func NewPcloudPvminstancesConsolePutBadRequest() *PcloudPvminstancesConsolePutBa return &PcloudPvminstancesConsolePutBadRequest{} } -/*PcloudPvminstancesConsolePutBadRequest handles this case with default header values. +/* PcloudPvminstancesConsolePutBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -103,6 +100,9 @@ type PcloudPvminstancesConsolePutBadRequest struct { func (o *PcloudPvminstancesConsolePutBadRequest) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/console][%d] pcloudPvminstancesConsolePutBadRequest %+v", 400, o.Payload) } +func (o *PcloudPvminstancesConsolePutBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesConsolePutBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -121,7 +121,7 @@ func NewPcloudPvminstancesConsolePutUnauthorized() *PcloudPvminstancesConsolePut return &PcloudPvminstancesConsolePutUnauthorized{} } -/*PcloudPvminstancesConsolePutUnauthorized handles this case with default header values. +/* PcloudPvminstancesConsolePutUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -132,6 +132,9 @@ type PcloudPvminstancesConsolePutUnauthorized struct { func (o *PcloudPvminstancesConsolePutUnauthorized) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/console][%d] pcloudPvminstancesConsolePutUnauthorized %+v", 401, o.Payload) } +func (o *PcloudPvminstancesConsolePutUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesConsolePutUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -150,7 +153,7 @@ func NewPcloudPvminstancesConsolePutInternalServerError() *PcloudPvminstancesCon return &PcloudPvminstancesConsolePutInternalServerError{} } -/*PcloudPvminstancesConsolePutInternalServerError handles this case with default header values. +/* PcloudPvminstancesConsolePutInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -161,6 +164,9 @@ type PcloudPvminstancesConsolePutInternalServerError struct { func (o *PcloudPvminstancesConsolePutInternalServerError) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/console][%d] pcloudPvminstancesConsolePutInternalServerError %+v", 500, o.Payload) } +func (o *PcloudPvminstancesConsolePutInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesConsolePutInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_delete_parameters.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_delete_parameters.go index 4f6a9c5a..8c369a01 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_delete_parameters.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_delete_parameters.go @@ -13,68 +13,68 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - - strfmt "github.com/go-openapi/strfmt" ) -// NewPcloudPvminstancesDeleteParams creates a new PcloudPvminstancesDeleteParams object -// with the default values initialized. +// NewPcloudPvminstancesDeleteParams creates a new PcloudPvminstancesDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudPvminstancesDeleteParams() *PcloudPvminstancesDeleteParams { - var () return &PcloudPvminstancesDeleteParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudPvminstancesDeleteParamsWithTimeout creates a new PcloudPvminstancesDeleteParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudPvminstancesDeleteParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesDeleteParams { - var () return &PcloudPvminstancesDeleteParams{ - timeout: timeout, } } // NewPcloudPvminstancesDeleteParamsWithContext creates a new PcloudPvminstancesDeleteParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudPvminstancesDeleteParamsWithContext(ctx context.Context) *PcloudPvminstancesDeleteParams { - var () return &PcloudPvminstancesDeleteParams{ - Context: ctx, } } // NewPcloudPvminstancesDeleteParamsWithHTTPClient creates a new PcloudPvminstancesDeleteParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudPvminstancesDeleteParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesDeleteParams { - var () return &PcloudPvminstancesDeleteParams{ HTTPClient: client, } } -/*PcloudPvminstancesDeleteParams contains all the parameters to send to the API endpoint -for the pcloud pvminstances delete operation typically these are written to a http.Request +/* PcloudPvminstancesDeleteParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances delete operation. + + Typically these are written to a http.Request. */ type PcloudPvminstancesDeleteParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*DeleteDataVolumes - Indicates if all data volumes attached to the PVMInstance should be deleted when deleting the PVMInstance. Shared data volumes will be deleted if there are no other PVMInstances attached. + /* DeleteDataVolumes. + + Indicates if all data volumes attached to the PVMInstance should be deleted when deleting the PVMInstance. Shared data volumes will be deleted if there are no other PVMInstances attached. */ DeleteDataVolumes *bool - /*PvmInstanceID - PCloud PVM Instance ID + /* PvmInstanceID. + + PCloud PVM Instance ID */ PvmInstanceID string @@ -83,6 +83,21 @@ type PcloudPvminstancesDeleteParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud pvminstances delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesDeleteParams) WithDefaults() *PcloudPvminstancesDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud pvminstances delete params func (o *PcloudPvminstancesDeleteParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesDeleteParams { o.SetTimeout(timeout) @@ -166,16 +181,17 @@ func (o *PcloudPvminstancesDeleteParams) WriteToRequest(r runtime.ClientRequest, // query param delete_data_volumes var qrDeleteDataVolumes bool + if o.DeleteDataVolumes != nil { qrDeleteDataVolumes = *o.DeleteDataVolumes } qDeleteDataVolumes := swag.FormatBool(qrDeleteDataVolumes) if qDeleteDataVolumes != "" { + if err := r.SetQueryParam("delete_data_volumes", qDeleteDataVolumes); err != nil { return err } } - } // path param pvm_instance_id diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_delete_responses.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_delete_responses.go index 65007fe2..18189dcd 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_delete_responses.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_delete_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudPvminstancesDeleteReader is a Reader for the PcloudPvminstancesDelete structure. @@ -24,51 +23,44 @@ type PcloudPvminstancesDeleteReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudPvminstancesDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudPvminstancesDeleteOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudPvminstancesDeleteBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudPvminstancesDeleteUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudPvminstancesDeleteNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 410: result := NewPcloudPvminstancesDeleteGone() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudPvminstancesDeleteInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -77,7 +69,7 @@ func NewPcloudPvminstancesDeleteOK() *PcloudPvminstancesDeleteOK { return &PcloudPvminstancesDeleteOK{} } -/*PcloudPvminstancesDeleteOK handles this case with default header values. +/* PcloudPvminstancesDeleteOK describes a response with status code 200, with default header values. OK */ @@ -88,6 +80,9 @@ type PcloudPvminstancesDeleteOK struct { func (o *PcloudPvminstancesDeleteOK) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}][%d] pcloudPvminstancesDeleteOK %+v", 200, o.Payload) } +func (o *PcloudPvminstancesDeleteOK) GetPayload() models.Object { + return o.Payload +} func (o *PcloudPvminstancesDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -104,7 +99,7 @@ func NewPcloudPvminstancesDeleteBadRequest() *PcloudPvminstancesDeleteBadRequest return &PcloudPvminstancesDeleteBadRequest{} } -/*PcloudPvminstancesDeleteBadRequest handles this case with default header values. +/* PcloudPvminstancesDeleteBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -115,6 +110,9 @@ type PcloudPvminstancesDeleteBadRequest struct { func (o *PcloudPvminstancesDeleteBadRequest) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}][%d] pcloudPvminstancesDeleteBadRequest %+v", 400, o.Payload) } +func (o *PcloudPvminstancesDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -133,7 +131,7 @@ func NewPcloudPvminstancesDeleteUnauthorized() *PcloudPvminstancesDeleteUnauthor return &PcloudPvminstancesDeleteUnauthorized{} } -/*PcloudPvminstancesDeleteUnauthorized handles this case with default header values. +/* PcloudPvminstancesDeleteUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -144,6 +142,9 @@ type PcloudPvminstancesDeleteUnauthorized struct { func (o *PcloudPvminstancesDeleteUnauthorized) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}][%d] pcloudPvminstancesDeleteUnauthorized %+v", 401, o.Payload) } +func (o *PcloudPvminstancesDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -162,7 +163,7 @@ func NewPcloudPvminstancesDeleteNotFound() *PcloudPvminstancesDeleteNotFound { return &PcloudPvminstancesDeleteNotFound{} } -/*PcloudPvminstancesDeleteNotFound handles this case with default header values. +/* PcloudPvminstancesDeleteNotFound describes a response with status code 404, with default header values. Not Found */ @@ -173,6 +174,9 @@ type PcloudPvminstancesDeleteNotFound struct { func (o *PcloudPvminstancesDeleteNotFound) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}][%d] pcloudPvminstancesDeleteNotFound %+v", 404, o.Payload) } +func (o *PcloudPvminstancesDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -191,7 +195,7 @@ func NewPcloudPvminstancesDeleteGone() *PcloudPvminstancesDeleteGone { return &PcloudPvminstancesDeleteGone{} } -/*PcloudPvminstancesDeleteGone handles this case with default header values. +/* PcloudPvminstancesDeleteGone describes a response with status code 410, with default header values. Gone */ @@ -202,6 +206,9 @@ type PcloudPvminstancesDeleteGone struct { func (o *PcloudPvminstancesDeleteGone) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}][%d] pcloudPvminstancesDeleteGone %+v", 410, o.Payload) } +func (o *PcloudPvminstancesDeleteGone) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesDeleteGone) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -220,7 +227,7 @@ func NewPcloudPvminstancesDeleteInternalServerError() *PcloudPvminstancesDeleteI return &PcloudPvminstancesDeleteInternalServerError{} } -/*PcloudPvminstancesDeleteInternalServerError handles this case with default header values. +/* PcloudPvminstancesDeleteInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -231,6 +238,9 @@ type PcloudPvminstancesDeleteInternalServerError struct { func (o *PcloudPvminstancesDeleteInternalServerError) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}][%d] pcloudPvminstancesDeleteInternalServerError %+v", 500, o.Payload) } +func (o *PcloudPvminstancesDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_get_parameters.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_get_parameters.go index 5badd59c..ebbc6f4a 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_get_parameters.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_get_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudPvminstancesGetParams creates a new PcloudPvminstancesGetParams object -// with the default values initialized. +// NewPcloudPvminstancesGetParams creates a new PcloudPvminstancesGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudPvminstancesGetParams() *PcloudPvminstancesGetParams { - var () return &PcloudPvminstancesGetParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudPvminstancesGetParamsWithTimeout creates a new PcloudPvminstancesGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudPvminstancesGetParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesGetParams { - var () return &PcloudPvminstancesGetParams{ - timeout: timeout, } } // NewPcloudPvminstancesGetParamsWithContext creates a new PcloudPvminstancesGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudPvminstancesGetParamsWithContext(ctx context.Context) *PcloudPvminstancesGetParams { - var () return &PcloudPvminstancesGetParams{ - Context: ctx, } } // NewPcloudPvminstancesGetParamsWithHTTPClient creates a new PcloudPvminstancesGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudPvminstancesGetParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesGetParams { - var () return &PcloudPvminstancesGetParams{ HTTPClient: client, } } -/*PcloudPvminstancesGetParams contains all the parameters to send to the API endpoint -for the pcloud pvminstances get operation typically these are written to a http.Request +/* PcloudPvminstancesGetParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances get operation. + + Typically these are written to a http.Request. */ type PcloudPvminstancesGetParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*PvmInstanceID - PCloud PVM Instance ID + /* PvmInstanceID. + + PCloud PVM Instance ID */ PvmInstanceID string @@ -77,6 +76,21 @@ type PcloudPvminstancesGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud pvminstances get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesGetParams) WithDefaults() *PcloudPvminstancesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud pvminstances get params func (o *PcloudPvminstancesGetParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesGetParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_get_responses.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_get_responses.go index 1ab6096b..ddd375ee 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_get_responses.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudPvminstancesGetReader is a Reader for the PcloudPvminstancesGet structure. @@ -24,44 +23,38 @@ type PcloudPvminstancesGetReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudPvminstancesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudPvminstancesGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudPvminstancesGetBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudPvminstancesGetUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudPvminstancesGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudPvminstancesGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudPvminstancesGetOK() *PcloudPvminstancesGetOK { return &PcloudPvminstancesGetOK{} } -/*PcloudPvminstancesGetOK handles this case with default header values. +/* PcloudPvminstancesGetOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudPvminstancesGetOK struct { func (o *PcloudPvminstancesGetOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}][%d] pcloudPvminstancesGetOK %+v", 200, o.Payload) } +func (o *PcloudPvminstancesGetOK) GetPayload() *models.PVMInstance { + return o.Payload +} func (o *PcloudPvminstancesGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudPvminstancesGetBadRequest() *PcloudPvminstancesGetBadRequest { return &PcloudPvminstancesGetBadRequest{} } -/*PcloudPvminstancesGetBadRequest handles this case with default header values. +/* PcloudPvminstancesGetBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudPvminstancesGetBadRequest struct { func (o *PcloudPvminstancesGetBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}][%d] pcloudPvminstancesGetBadRequest %+v", 400, o.Payload) } +func (o *PcloudPvminstancesGetBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudPvminstancesGetUnauthorized() *PcloudPvminstancesGetUnauthorized { return &PcloudPvminstancesGetUnauthorized{} } -/*PcloudPvminstancesGetUnauthorized handles this case with default header values. +/* PcloudPvminstancesGetUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudPvminstancesGetUnauthorized struct { func (o *PcloudPvminstancesGetUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}][%d] pcloudPvminstancesGetUnauthorized %+v", 401, o.Payload) } +func (o *PcloudPvminstancesGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudPvminstancesGetNotFound() *PcloudPvminstancesGetNotFound { return &PcloudPvminstancesGetNotFound{} } -/*PcloudPvminstancesGetNotFound handles this case with default header values. +/* PcloudPvminstancesGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -168,6 +170,9 @@ type PcloudPvminstancesGetNotFound struct { func (o *PcloudPvminstancesGetNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}][%d] pcloudPvminstancesGetNotFound %+v", 404, o.Payload) } +func (o *PcloudPvminstancesGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudPvminstancesGetInternalServerError() *PcloudPvminstancesGetInterna return &PcloudPvminstancesGetInternalServerError{} } -/*PcloudPvminstancesGetInternalServerError handles this case with default header values. +/* PcloudPvminstancesGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudPvminstancesGetInternalServerError struct { func (o *PcloudPvminstancesGetInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}][%d] pcloudPvminstancesGetInternalServerError %+v", 500, o.Payload) } +func (o *PcloudPvminstancesGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_getall_parameters.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_getall_parameters.go index 3e530984..88205d33 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_getall_parameters.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_getall_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudPvminstancesGetallParams creates a new PcloudPvminstancesGetallParams object -// with the default values initialized. +// NewPcloudPvminstancesGetallParams creates a new PcloudPvminstancesGetallParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudPvminstancesGetallParams() *PcloudPvminstancesGetallParams { - var () return &PcloudPvminstancesGetallParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudPvminstancesGetallParamsWithTimeout creates a new PcloudPvminstancesGetallParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudPvminstancesGetallParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesGetallParams { - var () return &PcloudPvminstancesGetallParams{ - timeout: timeout, } } // NewPcloudPvminstancesGetallParamsWithContext creates a new PcloudPvminstancesGetallParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudPvminstancesGetallParamsWithContext(ctx context.Context) *PcloudPvminstancesGetallParams { - var () return &PcloudPvminstancesGetallParams{ - Context: ctx, } } // NewPcloudPvminstancesGetallParamsWithHTTPClient creates a new PcloudPvminstancesGetallParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudPvminstancesGetallParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesGetallParams { - var () return &PcloudPvminstancesGetallParams{ HTTPClient: client, } } -/*PcloudPvminstancesGetallParams contains all the parameters to send to the API endpoint -for the pcloud pvminstances getall operation typically these are written to a http.Request +/* PcloudPvminstancesGetallParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances getall operation. + + Typically these are written to a http.Request. */ type PcloudPvminstancesGetallParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -72,6 +70,21 @@ type PcloudPvminstancesGetallParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud pvminstances getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesGetallParams) WithDefaults() *PcloudPvminstancesGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesGetallParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud pvminstances getall params func (o *PcloudPvminstancesGetallParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesGetallParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_getall_responses.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_getall_responses.go index 03179620..f55d7623 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_getall_responses.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_getall_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudPvminstancesGetallReader is a Reader for the PcloudPvminstancesGetall structure. @@ -24,37 +23,32 @@ type PcloudPvminstancesGetallReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudPvminstancesGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudPvminstancesGetallOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudPvminstancesGetallBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudPvminstancesGetallUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudPvminstancesGetallInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -63,7 +57,7 @@ func NewPcloudPvminstancesGetallOK() *PcloudPvminstancesGetallOK { return &PcloudPvminstancesGetallOK{} } -/*PcloudPvminstancesGetallOK handles this case with default header values. +/* PcloudPvminstancesGetallOK describes a response with status code 200, with default header values. OK */ @@ -74,6 +68,9 @@ type PcloudPvminstancesGetallOK struct { func (o *PcloudPvminstancesGetallOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances][%d] pcloudPvminstancesGetallOK %+v", 200, o.Payload) } +func (o *PcloudPvminstancesGetallOK) GetPayload() *models.PVMInstances { + return o.Payload +} func (o *PcloudPvminstancesGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -92,7 +89,7 @@ func NewPcloudPvminstancesGetallBadRequest() *PcloudPvminstancesGetallBadRequest return &PcloudPvminstancesGetallBadRequest{} } -/*PcloudPvminstancesGetallBadRequest handles this case with default header values. +/* PcloudPvminstancesGetallBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -103,6 +100,9 @@ type PcloudPvminstancesGetallBadRequest struct { func (o *PcloudPvminstancesGetallBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances][%d] pcloudPvminstancesGetallBadRequest %+v", 400, o.Payload) } +func (o *PcloudPvminstancesGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesGetallBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -121,7 +121,7 @@ func NewPcloudPvminstancesGetallUnauthorized() *PcloudPvminstancesGetallUnauthor return &PcloudPvminstancesGetallUnauthorized{} } -/*PcloudPvminstancesGetallUnauthorized handles this case with default header values. +/* PcloudPvminstancesGetallUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -132,6 +132,9 @@ type PcloudPvminstancesGetallUnauthorized struct { func (o *PcloudPvminstancesGetallUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances][%d] pcloudPvminstancesGetallUnauthorized %+v", 401, o.Payload) } +func (o *PcloudPvminstancesGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesGetallUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -150,7 +153,7 @@ func NewPcloudPvminstancesGetallInternalServerError() *PcloudPvminstancesGetallI return &PcloudPvminstancesGetallInternalServerError{} } -/*PcloudPvminstancesGetallInternalServerError handles this case with default header values. +/* PcloudPvminstancesGetallInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -161,6 +164,9 @@ type PcloudPvminstancesGetallInternalServerError struct { func (o *PcloudPvminstancesGetallInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances][%d] pcloudPvminstancesGetallInternalServerError %+v", 500, o.Payload) } +func (o *PcloudPvminstancesGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesGetallInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_delete_parameters.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_delete_parameters.go index 8cc10093..5b6b0ee4 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_delete_parameters.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_delete_parameters.go @@ -13,74 +13,75 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudPvminstancesNetworksDeleteParams creates a new PcloudPvminstancesNetworksDeleteParams object -// with the default values initialized. +// NewPcloudPvminstancesNetworksDeleteParams creates a new PcloudPvminstancesNetworksDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudPvminstancesNetworksDeleteParams() *PcloudPvminstancesNetworksDeleteParams { - var () return &PcloudPvminstancesNetworksDeleteParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudPvminstancesNetworksDeleteParamsWithTimeout creates a new PcloudPvminstancesNetworksDeleteParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudPvminstancesNetworksDeleteParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesNetworksDeleteParams { - var () return &PcloudPvminstancesNetworksDeleteParams{ - timeout: timeout, } } // NewPcloudPvminstancesNetworksDeleteParamsWithContext creates a new PcloudPvminstancesNetworksDeleteParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudPvminstancesNetworksDeleteParamsWithContext(ctx context.Context) *PcloudPvminstancesNetworksDeleteParams { - var () return &PcloudPvminstancesNetworksDeleteParams{ - Context: ctx, } } // NewPcloudPvminstancesNetworksDeleteParamsWithHTTPClient creates a new PcloudPvminstancesNetworksDeleteParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudPvminstancesNetworksDeleteParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesNetworksDeleteParams { - var () return &PcloudPvminstancesNetworksDeleteParams{ HTTPClient: client, } } -/*PcloudPvminstancesNetworksDeleteParams contains all the parameters to send to the API endpoint -for the pcloud pvminstances networks delete operation typically these are written to a http.Request +/* PcloudPvminstancesNetworksDeleteParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances networks delete operation. + + Typically these are written to a http.Request. */ type PcloudPvminstancesNetworksDeleteParams struct { - /*Body - Remove a network from PVM Instance parameters + /* Body. + Remove a network from PVM Instance parameters */ Body *models.PVMInstanceRemoveNetwork - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*NetworkID - Network ID + /* NetworkID. + + Network ID */ NetworkID string - /*PvmInstanceID - PCloud PVM Instance ID + /* PvmInstanceID. + + PCloud PVM Instance ID */ PvmInstanceID string @@ -89,6 +90,21 @@ type PcloudPvminstancesNetworksDeleteParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud pvminstances networks delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesNetworksDeleteParams) WithDefaults() *PcloudPvminstancesNetworksDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances networks delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesNetworksDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud pvminstances networks delete params func (o *PcloudPvminstancesNetworksDeleteParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesNetworksDeleteParams { o.SetTimeout(timeout) @@ -173,7 +189,6 @@ func (o *PcloudPvminstancesNetworksDeleteParams) WriteToRequest(r runtime.Client return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_delete_responses.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_delete_responses.go index 750efaf0..e3ce9d7e 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_delete_responses.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_delete_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudPvminstancesNetworksDeleteReader is a Reader for the PcloudPvminstancesNetworksDelete structure. @@ -24,44 +23,38 @@ type PcloudPvminstancesNetworksDeleteReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudPvminstancesNetworksDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudPvminstancesNetworksDeleteOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudPvminstancesNetworksDeleteBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudPvminstancesNetworksDeleteUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 410: result := NewPcloudPvminstancesNetworksDeleteGone() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudPvminstancesNetworksDeleteInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudPvminstancesNetworksDeleteOK() *PcloudPvminstancesNetworksDeleteOK return &PcloudPvminstancesNetworksDeleteOK{} } -/*PcloudPvminstancesNetworksDeleteOK handles this case with default header values. +/* PcloudPvminstancesNetworksDeleteOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudPvminstancesNetworksDeleteOK struct { func (o *PcloudPvminstancesNetworksDeleteOK) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks/{network_id}][%d] pcloudPvminstancesNetworksDeleteOK %+v", 200, o.Payload) } +func (o *PcloudPvminstancesNetworksDeleteOK) GetPayload() models.Object { + return o.Payload +} func (o *PcloudPvminstancesNetworksDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -97,7 +93,7 @@ func NewPcloudPvminstancesNetworksDeleteBadRequest() *PcloudPvminstancesNetworks return &PcloudPvminstancesNetworksDeleteBadRequest{} } -/*PcloudPvminstancesNetworksDeleteBadRequest handles this case with default header values. +/* PcloudPvminstancesNetworksDeleteBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -108,6 +104,9 @@ type PcloudPvminstancesNetworksDeleteBadRequest struct { func (o *PcloudPvminstancesNetworksDeleteBadRequest) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks/{network_id}][%d] pcloudPvminstancesNetworksDeleteBadRequest %+v", 400, o.Payload) } +func (o *PcloudPvminstancesNetworksDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesNetworksDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -126,7 +125,7 @@ func NewPcloudPvminstancesNetworksDeleteUnauthorized() *PcloudPvminstancesNetwor return &PcloudPvminstancesNetworksDeleteUnauthorized{} } -/*PcloudPvminstancesNetworksDeleteUnauthorized handles this case with default header values. +/* PcloudPvminstancesNetworksDeleteUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -137,6 +136,9 @@ type PcloudPvminstancesNetworksDeleteUnauthorized struct { func (o *PcloudPvminstancesNetworksDeleteUnauthorized) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks/{network_id}][%d] pcloudPvminstancesNetworksDeleteUnauthorized %+v", 401, o.Payload) } +func (o *PcloudPvminstancesNetworksDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesNetworksDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -155,7 +157,7 @@ func NewPcloudPvminstancesNetworksDeleteGone() *PcloudPvminstancesNetworksDelete return &PcloudPvminstancesNetworksDeleteGone{} } -/*PcloudPvminstancesNetworksDeleteGone handles this case with default header values. +/* PcloudPvminstancesNetworksDeleteGone describes a response with status code 410, with default header values. Gone */ @@ -166,6 +168,9 @@ type PcloudPvminstancesNetworksDeleteGone struct { func (o *PcloudPvminstancesNetworksDeleteGone) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks/{network_id}][%d] pcloudPvminstancesNetworksDeleteGone %+v", 410, o.Payload) } +func (o *PcloudPvminstancesNetworksDeleteGone) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesNetworksDeleteGone) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -184,7 +189,7 @@ func NewPcloudPvminstancesNetworksDeleteInternalServerError() *PcloudPvminstance return &PcloudPvminstancesNetworksDeleteInternalServerError{} } -/*PcloudPvminstancesNetworksDeleteInternalServerError handles this case with default header values. +/* PcloudPvminstancesNetworksDeleteInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -195,6 +200,9 @@ type PcloudPvminstancesNetworksDeleteInternalServerError struct { func (o *PcloudPvminstancesNetworksDeleteInternalServerError) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks/{network_id}][%d] pcloudPvminstancesNetworksDeleteInternalServerError %+v", 500, o.Payload) } +func (o *PcloudPvminstancesNetworksDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesNetworksDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_get_parameters.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_get_parameters.go index 98888850..c9a444ef 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_get_parameters.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_get_parameters.go @@ -13,67 +13,67 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudPvminstancesNetworksGetParams creates a new PcloudPvminstancesNetworksGetParams object -// with the default values initialized. +// NewPcloudPvminstancesNetworksGetParams creates a new PcloudPvminstancesNetworksGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudPvminstancesNetworksGetParams() *PcloudPvminstancesNetworksGetParams { - var () return &PcloudPvminstancesNetworksGetParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudPvminstancesNetworksGetParamsWithTimeout creates a new PcloudPvminstancesNetworksGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudPvminstancesNetworksGetParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesNetworksGetParams { - var () return &PcloudPvminstancesNetworksGetParams{ - timeout: timeout, } } // NewPcloudPvminstancesNetworksGetParamsWithContext creates a new PcloudPvminstancesNetworksGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudPvminstancesNetworksGetParamsWithContext(ctx context.Context) *PcloudPvminstancesNetworksGetParams { - var () return &PcloudPvminstancesNetworksGetParams{ - Context: ctx, } } // NewPcloudPvminstancesNetworksGetParamsWithHTTPClient creates a new PcloudPvminstancesNetworksGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudPvminstancesNetworksGetParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesNetworksGetParams { - var () return &PcloudPvminstancesNetworksGetParams{ HTTPClient: client, } } -/*PcloudPvminstancesNetworksGetParams contains all the parameters to send to the API endpoint -for the pcloud pvminstances networks get operation typically these are written to a http.Request +/* PcloudPvminstancesNetworksGetParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances networks get operation. + + Typically these are written to a http.Request. */ type PcloudPvminstancesNetworksGetParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*NetworkID - Network ID + /* NetworkID. + + Network ID */ NetworkID string - /*PvmInstanceID - PCloud PVM Instance ID + /* PvmInstanceID. + + PCloud PVM Instance ID */ PvmInstanceID string @@ -82,6 +82,21 @@ type PcloudPvminstancesNetworksGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud pvminstances networks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesNetworksGetParams) WithDefaults() *PcloudPvminstancesNetworksGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances networks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesNetworksGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud pvminstances networks get params func (o *PcloudPvminstancesNetworksGetParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesNetworksGetParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_get_responses.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_get_responses.go index 3e29b245..1587866e 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_get_responses.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudPvminstancesNetworksGetReader is a Reader for the PcloudPvminstancesNetworksGet structure. @@ -24,37 +23,32 @@ type PcloudPvminstancesNetworksGetReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudPvminstancesNetworksGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudPvminstancesNetworksGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 401: result := NewPcloudPvminstancesNetworksGetUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudPvminstancesNetworksGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudPvminstancesNetworksGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -63,7 +57,7 @@ func NewPcloudPvminstancesNetworksGetOK() *PcloudPvminstancesNetworksGetOK { return &PcloudPvminstancesNetworksGetOK{} } -/*PcloudPvminstancesNetworksGetOK handles this case with default header values. +/* PcloudPvminstancesNetworksGetOK describes a response with status code 200, with default header values. OK */ @@ -74,6 +68,9 @@ type PcloudPvminstancesNetworksGetOK struct { func (o *PcloudPvminstancesNetworksGetOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks/{network_id}][%d] pcloudPvminstancesNetworksGetOK %+v", 200, o.Payload) } +func (o *PcloudPvminstancesNetworksGetOK) GetPayload() *models.PVMInstanceNetworks { + return o.Payload +} func (o *PcloudPvminstancesNetworksGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -92,7 +89,7 @@ func NewPcloudPvminstancesNetworksGetUnauthorized() *PcloudPvminstancesNetworksG return &PcloudPvminstancesNetworksGetUnauthorized{} } -/*PcloudPvminstancesNetworksGetUnauthorized handles this case with default header values. +/* PcloudPvminstancesNetworksGetUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -103,6 +100,9 @@ type PcloudPvminstancesNetworksGetUnauthorized struct { func (o *PcloudPvminstancesNetworksGetUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks/{network_id}][%d] pcloudPvminstancesNetworksGetUnauthorized %+v", 401, o.Payload) } +func (o *PcloudPvminstancesNetworksGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesNetworksGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -121,7 +121,7 @@ func NewPcloudPvminstancesNetworksGetNotFound() *PcloudPvminstancesNetworksGetNo return &PcloudPvminstancesNetworksGetNotFound{} } -/*PcloudPvminstancesNetworksGetNotFound handles this case with default header values. +/* PcloudPvminstancesNetworksGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -132,6 +132,9 @@ type PcloudPvminstancesNetworksGetNotFound struct { func (o *PcloudPvminstancesNetworksGetNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks/{network_id}][%d] pcloudPvminstancesNetworksGetNotFound %+v", 404, o.Payload) } +func (o *PcloudPvminstancesNetworksGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesNetworksGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -150,7 +153,7 @@ func NewPcloudPvminstancesNetworksGetInternalServerError() *PcloudPvminstancesNe return &PcloudPvminstancesNetworksGetInternalServerError{} } -/*PcloudPvminstancesNetworksGetInternalServerError handles this case with default header values. +/* PcloudPvminstancesNetworksGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -161,6 +164,9 @@ type PcloudPvminstancesNetworksGetInternalServerError struct { func (o *PcloudPvminstancesNetworksGetInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks/{network_id}][%d] pcloudPvminstancesNetworksGetInternalServerError %+v", 500, o.Payload) } +func (o *PcloudPvminstancesNetworksGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesNetworksGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_getall_parameters.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_getall_parameters.go index c3d716a3..97fe7898 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_getall_parameters.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_getall_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudPvminstancesNetworksGetallParams creates a new PcloudPvminstancesNetworksGetallParams object -// with the default values initialized. +// NewPcloudPvminstancesNetworksGetallParams creates a new PcloudPvminstancesNetworksGetallParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudPvminstancesNetworksGetallParams() *PcloudPvminstancesNetworksGetallParams { - var () return &PcloudPvminstancesNetworksGetallParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudPvminstancesNetworksGetallParamsWithTimeout creates a new PcloudPvminstancesNetworksGetallParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudPvminstancesNetworksGetallParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesNetworksGetallParams { - var () return &PcloudPvminstancesNetworksGetallParams{ - timeout: timeout, } } // NewPcloudPvminstancesNetworksGetallParamsWithContext creates a new PcloudPvminstancesNetworksGetallParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudPvminstancesNetworksGetallParamsWithContext(ctx context.Context) *PcloudPvminstancesNetworksGetallParams { - var () return &PcloudPvminstancesNetworksGetallParams{ - Context: ctx, } } // NewPcloudPvminstancesNetworksGetallParamsWithHTTPClient creates a new PcloudPvminstancesNetworksGetallParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudPvminstancesNetworksGetallParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesNetworksGetallParams { - var () return &PcloudPvminstancesNetworksGetallParams{ HTTPClient: client, } } -/*PcloudPvminstancesNetworksGetallParams contains all the parameters to send to the API endpoint -for the pcloud pvminstances networks getall operation typically these are written to a http.Request +/* PcloudPvminstancesNetworksGetallParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances networks getall operation. + + Typically these are written to a http.Request. */ type PcloudPvminstancesNetworksGetallParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*PvmInstanceID - PCloud PVM Instance ID + /* PvmInstanceID. + + PCloud PVM Instance ID */ PvmInstanceID string @@ -77,6 +76,21 @@ type PcloudPvminstancesNetworksGetallParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud pvminstances networks getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesNetworksGetallParams) WithDefaults() *PcloudPvminstancesNetworksGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances networks getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesNetworksGetallParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud pvminstances networks getall params func (o *PcloudPvminstancesNetworksGetallParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesNetworksGetallParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_getall_responses.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_getall_responses.go index 7025b1e5..79103867 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_getall_responses.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_getall_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudPvminstancesNetworksGetallReader is a Reader for the PcloudPvminstancesNetworksGetall structure. @@ -24,37 +23,32 @@ type PcloudPvminstancesNetworksGetallReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudPvminstancesNetworksGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudPvminstancesNetworksGetallOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudPvminstancesNetworksGetallBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudPvminstancesNetworksGetallUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudPvminstancesNetworksGetallInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -63,7 +57,7 @@ func NewPcloudPvminstancesNetworksGetallOK() *PcloudPvminstancesNetworksGetallOK return &PcloudPvminstancesNetworksGetallOK{} } -/*PcloudPvminstancesNetworksGetallOK handles this case with default header values. +/* PcloudPvminstancesNetworksGetallOK describes a response with status code 200, with default header values. OK */ @@ -74,6 +68,9 @@ type PcloudPvminstancesNetworksGetallOK struct { func (o *PcloudPvminstancesNetworksGetallOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks][%d] pcloudPvminstancesNetworksGetallOK %+v", 200, o.Payload) } +func (o *PcloudPvminstancesNetworksGetallOK) GetPayload() *models.PVMInstanceNetworks { + return o.Payload +} func (o *PcloudPvminstancesNetworksGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -92,7 +89,7 @@ func NewPcloudPvminstancesNetworksGetallBadRequest() *PcloudPvminstancesNetworks return &PcloudPvminstancesNetworksGetallBadRequest{} } -/*PcloudPvminstancesNetworksGetallBadRequest handles this case with default header values. +/* PcloudPvminstancesNetworksGetallBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -103,6 +100,9 @@ type PcloudPvminstancesNetworksGetallBadRequest struct { func (o *PcloudPvminstancesNetworksGetallBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks][%d] pcloudPvminstancesNetworksGetallBadRequest %+v", 400, o.Payload) } +func (o *PcloudPvminstancesNetworksGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesNetworksGetallBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -121,7 +121,7 @@ func NewPcloudPvminstancesNetworksGetallUnauthorized() *PcloudPvminstancesNetwor return &PcloudPvminstancesNetworksGetallUnauthorized{} } -/*PcloudPvminstancesNetworksGetallUnauthorized handles this case with default header values. +/* PcloudPvminstancesNetworksGetallUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -132,6 +132,9 @@ type PcloudPvminstancesNetworksGetallUnauthorized struct { func (o *PcloudPvminstancesNetworksGetallUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks][%d] pcloudPvminstancesNetworksGetallUnauthorized %+v", 401, o.Payload) } +func (o *PcloudPvminstancesNetworksGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesNetworksGetallUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -150,7 +153,7 @@ func NewPcloudPvminstancesNetworksGetallInternalServerError() *PcloudPvminstance return &PcloudPvminstancesNetworksGetallInternalServerError{} } -/*PcloudPvminstancesNetworksGetallInternalServerError handles this case with default header values. +/* PcloudPvminstancesNetworksGetallInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -161,6 +164,9 @@ type PcloudPvminstancesNetworksGetallInternalServerError struct { func (o *PcloudPvminstancesNetworksGetallInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks][%d] pcloudPvminstancesNetworksGetallInternalServerError %+v", 500, o.Payload) } +func (o *PcloudPvminstancesNetworksGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesNetworksGetallInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_post_parameters.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_post_parameters.go index 21e09760..23c0b0d4 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_post_parameters.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_post_parameters.go @@ -13,69 +13,69 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudPvminstancesNetworksPostParams creates a new PcloudPvminstancesNetworksPostParams object -// with the default values initialized. +// NewPcloudPvminstancesNetworksPostParams creates a new PcloudPvminstancesNetworksPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudPvminstancesNetworksPostParams() *PcloudPvminstancesNetworksPostParams { - var () return &PcloudPvminstancesNetworksPostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudPvminstancesNetworksPostParamsWithTimeout creates a new PcloudPvminstancesNetworksPostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudPvminstancesNetworksPostParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesNetworksPostParams { - var () return &PcloudPvminstancesNetworksPostParams{ - timeout: timeout, } } // NewPcloudPvminstancesNetworksPostParamsWithContext creates a new PcloudPvminstancesNetworksPostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudPvminstancesNetworksPostParamsWithContext(ctx context.Context) *PcloudPvminstancesNetworksPostParams { - var () return &PcloudPvminstancesNetworksPostParams{ - Context: ctx, } } // NewPcloudPvminstancesNetworksPostParamsWithHTTPClient creates a new PcloudPvminstancesNetworksPostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudPvminstancesNetworksPostParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesNetworksPostParams { - var () return &PcloudPvminstancesNetworksPostParams{ HTTPClient: client, } } -/*PcloudPvminstancesNetworksPostParams contains all the parameters to send to the API endpoint -for the pcloud pvminstances networks post operation typically these are written to a http.Request +/* PcloudPvminstancesNetworksPostParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances networks post operation. + + Typically these are written to a http.Request. */ type PcloudPvminstancesNetworksPostParams struct { - /*Body - Add network to PVM Instance parameters + /* Body. + Add network to PVM Instance parameters */ Body *models.PVMInstanceAddNetwork - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*PvmInstanceID - PCloud PVM Instance ID + /* PvmInstanceID. + + PCloud PVM Instance ID */ PvmInstanceID string @@ -84,6 +84,21 @@ type PcloudPvminstancesNetworksPostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud pvminstances networks post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesNetworksPostParams) WithDefaults() *PcloudPvminstancesNetworksPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances networks post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesNetworksPostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud pvminstances networks post params func (o *PcloudPvminstancesNetworksPostParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesNetworksPostParams { o.SetTimeout(timeout) @@ -157,7 +172,6 @@ func (o *PcloudPvminstancesNetworksPostParams) WriteToRequest(r runtime.ClientRe return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_post_responses.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_post_responses.go index 17acedd2..4bd3ed07 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_post_responses.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudPvminstancesNetworksPostReader is a Reader for the PcloudPvminstancesNetworksPost structure. @@ -24,51 +23,44 @@ type PcloudPvminstancesNetworksPostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudPvminstancesNetworksPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 201: result := NewPcloudPvminstancesNetworksPostCreated() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudPvminstancesNetworksPostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudPvminstancesNetworksPostUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 409: result := NewPcloudPvminstancesNetworksPostConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudPvminstancesNetworksPostUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudPvminstancesNetworksPostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -77,7 +69,7 @@ func NewPcloudPvminstancesNetworksPostCreated() *PcloudPvminstancesNetworksPostC return &PcloudPvminstancesNetworksPostCreated{} } -/*PcloudPvminstancesNetworksPostCreated handles this case with default header values. +/* PcloudPvminstancesNetworksPostCreated describes a response with status code 201, with default header values. Created */ @@ -88,6 +80,9 @@ type PcloudPvminstancesNetworksPostCreated struct { func (o *PcloudPvminstancesNetworksPostCreated) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks][%d] pcloudPvminstancesNetworksPostCreated %+v", 201, o.Payload) } +func (o *PcloudPvminstancesNetworksPostCreated) GetPayload() *models.PVMInstanceNetwork { + return o.Payload +} func (o *PcloudPvminstancesNetworksPostCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -106,7 +101,7 @@ func NewPcloudPvminstancesNetworksPostBadRequest() *PcloudPvminstancesNetworksPo return &PcloudPvminstancesNetworksPostBadRequest{} } -/*PcloudPvminstancesNetworksPostBadRequest handles this case with default header values. +/* PcloudPvminstancesNetworksPostBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -117,6 +112,9 @@ type PcloudPvminstancesNetworksPostBadRequest struct { func (o *PcloudPvminstancesNetworksPostBadRequest) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks][%d] pcloudPvminstancesNetworksPostBadRequest %+v", 400, o.Payload) } +func (o *PcloudPvminstancesNetworksPostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesNetworksPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -135,7 +133,7 @@ func NewPcloudPvminstancesNetworksPostUnauthorized() *PcloudPvminstancesNetworks return &PcloudPvminstancesNetworksPostUnauthorized{} } -/*PcloudPvminstancesNetworksPostUnauthorized handles this case with default header values. +/* PcloudPvminstancesNetworksPostUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -146,6 +144,9 @@ type PcloudPvminstancesNetworksPostUnauthorized struct { func (o *PcloudPvminstancesNetworksPostUnauthorized) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks][%d] pcloudPvminstancesNetworksPostUnauthorized %+v", 401, o.Payload) } +func (o *PcloudPvminstancesNetworksPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesNetworksPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -164,7 +165,7 @@ func NewPcloudPvminstancesNetworksPostConflict() *PcloudPvminstancesNetworksPost return &PcloudPvminstancesNetworksPostConflict{} } -/*PcloudPvminstancesNetworksPostConflict handles this case with default header values. +/* PcloudPvminstancesNetworksPostConflict describes a response with status code 409, with default header values. Conflict */ @@ -175,6 +176,9 @@ type PcloudPvminstancesNetworksPostConflict struct { func (o *PcloudPvminstancesNetworksPostConflict) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks][%d] pcloudPvminstancesNetworksPostConflict %+v", 409, o.Payload) } +func (o *PcloudPvminstancesNetworksPostConflict) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesNetworksPostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -193,7 +197,7 @@ func NewPcloudPvminstancesNetworksPostUnprocessableEntity() *PcloudPvminstancesN return &PcloudPvminstancesNetworksPostUnprocessableEntity{} } -/*PcloudPvminstancesNetworksPostUnprocessableEntity handles this case with default header values. +/* PcloudPvminstancesNetworksPostUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -204,6 +208,9 @@ type PcloudPvminstancesNetworksPostUnprocessableEntity struct { func (o *PcloudPvminstancesNetworksPostUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks][%d] pcloudPvminstancesNetworksPostUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudPvminstancesNetworksPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesNetworksPostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -222,7 +229,7 @@ func NewPcloudPvminstancesNetworksPostInternalServerError() *PcloudPvminstancesN return &PcloudPvminstancesNetworksPostInternalServerError{} } -/*PcloudPvminstancesNetworksPostInternalServerError handles this case with default header values. +/* PcloudPvminstancesNetworksPostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -233,6 +240,9 @@ type PcloudPvminstancesNetworksPostInternalServerError struct { func (o *PcloudPvminstancesNetworksPostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks][%d] pcloudPvminstancesNetworksPostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudPvminstancesNetworksPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesNetworksPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_operations_post_parameters.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_operations_post_parameters.go index 28041b31..adf92278 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_operations_post_parameters.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_operations_post_parameters.go @@ -13,69 +13,69 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudPvminstancesOperationsPostParams creates a new PcloudPvminstancesOperationsPostParams object -// with the default values initialized. +// NewPcloudPvminstancesOperationsPostParams creates a new PcloudPvminstancesOperationsPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudPvminstancesOperationsPostParams() *PcloudPvminstancesOperationsPostParams { - var () return &PcloudPvminstancesOperationsPostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudPvminstancesOperationsPostParamsWithTimeout creates a new PcloudPvminstancesOperationsPostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudPvminstancesOperationsPostParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesOperationsPostParams { - var () return &PcloudPvminstancesOperationsPostParams{ - timeout: timeout, } } // NewPcloudPvminstancesOperationsPostParamsWithContext creates a new PcloudPvminstancesOperationsPostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudPvminstancesOperationsPostParamsWithContext(ctx context.Context) *PcloudPvminstancesOperationsPostParams { - var () return &PcloudPvminstancesOperationsPostParams{ - Context: ctx, } } // NewPcloudPvminstancesOperationsPostParamsWithHTTPClient creates a new PcloudPvminstancesOperationsPostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudPvminstancesOperationsPostParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesOperationsPostParams { - var () return &PcloudPvminstancesOperationsPostParams{ HTTPClient: client, } } -/*PcloudPvminstancesOperationsPostParams contains all the parameters to send to the API endpoint -for the pcloud pvminstances operations post operation typically these are written to a http.Request +/* PcloudPvminstancesOperationsPostParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances operations post operation. + + Typically these are written to a http.Request. */ type PcloudPvminstancesOperationsPostParams struct { - /*Body - Parameters for the desired operations + /* Body. + Parameters for the desired operations */ Body *models.PVMInstanceOperation - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*PvmInstanceID - PCloud PVM Instance ID + /* PvmInstanceID. + + PCloud PVM Instance ID */ PvmInstanceID string @@ -84,6 +84,21 @@ type PcloudPvminstancesOperationsPostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud pvminstances operations post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesOperationsPostParams) WithDefaults() *PcloudPvminstancesOperationsPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances operations post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesOperationsPostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud pvminstances operations post params func (o *PcloudPvminstancesOperationsPostParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesOperationsPostParams { o.SetTimeout(timeout) @@ -157,7 +172,6 @@ func (o *PcloudPvminstancesOperationsPostParams) WriteToRequest(r runtime.Client return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_operations_post_responses.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_operations_post_responses.go index 5d7e0269..a68b4319 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_operations_post_responses.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_operations_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudPvminstancesOperationsPostReader is a Reader for the PcloudPvminstancesOperationsPost structure. @@ -24,51 +23,44 @@ type PcloudPvminstancesOperationsPostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudPvminstancesOperationsPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudPvminstancesOperationsPostOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudPvminstancesOperationsPostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudPvminstancesOperationsPostUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudPvminstancesOperationsPostNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudPvminstancesOperationsPostUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudPvminstancesOperationsPostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -77,7 +69,7 @@ func NewPcloudPvminstancesOperationsPostOK() *PcloudPvminstancesOperationsPostOK return &PcloudPvminstancesOperationsPostOK{} } -/*PcloudPvminstancesOperationsPostOK handles this case with default header values. +/* PcloudPvminstancesOperationsPostOK describes a response with status code 200, with default header values. OK */ @@ -88,6 +80,9 @@ type PcloudPvminstancesOperationsPostOK struct { func (o *PcloudPvminstancesOperationsPostOK) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/operations][%d] pcloudPvminstancesOperationsPostOK %+v", 200, o.Payload) } +func (o *PcloudPvminstancesOperationsPostOK) GetPayload() models.Object { + return o.Payload +} func (o *PcloudPvminstancesOperationsPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -104,7 +99,7 @@ func NewPcloudPvminstancesOperationsPostBadRequest() *PcloudPvminstancesOperatio return &PcloudPvminstancesOperationsPostBadRequest{} } -/*PcloudPvminstancesOperationsPostBadRequest handles this case with default header values. +/* PcloudPvminstancesOperationsPostBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -115,6 +110,9 @@ type PcloudPvminstancesOperationsPostBadRequest struct { func (o *PcloudPvminstancesOperationsPostBadRequest) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/operations][%d] pcloudPvminstancesOperationsPostBadRequest %+v", 400, o.Payload) } +func (o *PcloudPvminstancesOperationsPostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesOperationsPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -133,7 +131,7 @@ func NewPcloudPvminstancesOperationsPostUnauthorized() *PcloudPvminstancesOperat return &PcloudPvminstancesOperationsPostUnauthorized{} } -/*PcloudPvminstancesOperationsPostUnauthorized handles this case with default header values. +/* PcloudPvminstancesOperationsPostUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -144,6 +142,9 @@ type PcloudPvminstancesOperationsPostUnauthorized struct { func (o *PcloudPvminstancesOperationsPostUnauthorized) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/operations][%d] pcloudPvminstancesOperationsPostUnauthorized %+v", 401, o.Payload) } +func (o *PcloudPvminstancesOperationsPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesOperationsPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -162,7 +163,7 @@ func NewPcloudPvminstancesOperationsPostNotFound() *PcloudPvminstancesOperations return &PcloudPvminstancesOperationsPostNotFound{} } -/*PcloudPvminstancesOperationsPostNotFound handles this case with default header values. +/* PcloudPvminstancesOperationsPostNotFound describes a response with status code 404, with default header values. Not Found */ @@ -173,6 +174,9 @@ type PcloudPvminstancesOperationsPostNotFound struct { func (o *PcloudPvminstancesOperationsPostNotFound) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/operations][%d] pcloudPvminstancesOperationsPostNotFound %+v", 404, o.Payload) } +func (o *PcloudPvminstancesOperationsPostNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesOperationsPostNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -191,7 +195,7 @@ func NewPcloudPvminstancesOperationsPostUnprocessableEntity() *PcloudPvminstance return &PcloudPvminstancesOperationsPostUnprocessableEntity{} } -/*PcloudPvminstancesOperationsPostUnprocessableEntity handles this case with default header values. +/* PcloudPvminstancesOperationsPostUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -202,6 +206,9 @@ type PcloudPvminstancesOperationsPostUnprocessableEntity struct { func (o *PcloudPvminstancesOperationsPostUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/operations][%d] pcloudPvminstancesOperationsPostUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudPvminstancesOperationsPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesOperationsPostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -220,7 +227,7 @@ func NewPcloudPvminstancesOperationsPostInternalServerError() *PcloudPvminstance return &PcloudPvminstancesOperationsPostInternalServerError{} } -/*PcloudPvminstancesOperationsPostInternalServerError handles this case with default header values. +/* PcloudPvminstancesOperationsPostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -231,6 +238,9 @@ type PcloudPvminstancesOperationsPostInternalServerError struct { func (o *PcloudPvminstancesOperationsPostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/operations][%d] pcloudPvminstancesOperationsPostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudPvminstancesOperationsPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesOperationsPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_post_parameters.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_post_parameters.go index a6159876..4720dc28 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_post_parameters.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_post_parameters.go @@ -13,70 +13,70 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudPvminstancesPostParams creates a new PcloudPvminstancesPostParams object -// with the default values initialized. +// NewPcloudPvminstancesPostParams creates a new PcloudPvminstancesPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudPvminstancesPostParams() *PcloudPvminstancesPostParams { - var () return &PcloudPvminstancesPostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudPvminstancesPostParamsWithTimeout creates a new PcloudPvminstancesPostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudPvminstancesPostParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesPostParams { - var () return &PcloudPvminstancesPostParams{ - timeout: timeout, } } // NewPcloudPvminstancesPostParamsWithContext creates a new PcloudPvminstancesPostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudPvminstancesPostParamsWithContext(ctx context.Context) *PcloudPvminstancesPostParams { - var () return &PcloudPvminstancesPostParams{ - Context: ctx, } } // NewPcloudPvminstancesPostParamsWithHTTPClient creates a new PcloudPvminstancesPostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudPvminstancesPostParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesPostParams { - var () return &PcloudPvminstancesPostParams{ HTTPClient: client, } } -/*PcloudPvminstancesPostParams contains all the parameters to send to the API endpoint -for the pcloud pvminstances post operation typically these are written to a http.Request +/* PcloudPvminstancesPostParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances post operation. + + Typically these are written to a http.Request. */ type PcloudPvminstancesPostParams struct { - /*Body - Parameters for the creation of a new Power VM Instance + /* Body. + Parameters for the creation of a new Power VM Instance */ Body *models.PVMInstanceCreate - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*SkipHostValidation - Option to skip host validation on PVMInstance Create API + /* SkipHostValidation. + + Option to skip host validation on PVMInstance Create API */ SkipHostValidation *bool @@ -85,6 +85,21 @@ type PcloudPvminstancesPostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud pvminstances post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesPostParams) WithDefaults() *PcloudPvminstancesPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesPostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud pvminstances post params func (o *PcloudPvminstancesPostParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesPostParams { o.SetTimeout(timeout) @@ -158,7 +173,6 @@ func (o *PcloudPvminstancesPostParams) WriteToRequest(r runtime.ClientRequest, r return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err @@ -174,16 +188,17 @@ func (o *PcloudPvminstancesPostParams) WriteToRequest(r runtime.ClientRequest, r // query param skipHostValidation var qrSkipHostValidation bool + if o.SkipHostValidation != nil { qrSkipHostValidation = *o.SkipHostValidation } qSkipHostValidation := swag.FormatBool(qrSkipHostValidation) if qSkipHostValidation != "" { + if err := r.SetQueryParam("skipHostValidation", qSkipHostValidation); err != nil { return err } } - } if len(res) > 0 { diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_post_responses.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_post_responses.go index ee486e4f..79011037 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_post_responses.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudPvminstancesPostReader is a Reader for the PcloudPvminstancesPost structure. @@ -24,72 +23,62 @@ type PcloudPvminstancesPostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudPvminstancesPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudPvminstancesPostOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 201: result := NewPcloudPvminstancesPostCreated() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 202: result := NewPcloudPvminstancesPostAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudPvminstancesPostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudPvminstancesPostUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 409: result := NewPcloudPvminstancesPostConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudPvminstancesPostUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudPvminstancesPostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 504: result := NewPcloudPvminstancesPostGatewayTimeout() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -98,7 +87,7 @@ func NewPcloudPvminstancesPostOK() *PcloudPvminstancesPostOK { return &PcloudPvminstancesPostOK{} } -/*PcloudPvminstancesPostOK handles this case with default header values. +/* PcloudPvminstancesPostOK describes a response with status code 200, with default header values. OK */ @@ -109,6 +98,9 @@ type PcloudPvminstancesPostOK struct { func (o *PcloudPvminstancesPostOK) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances][%d] pcloudPvminstancesPostOK %+v", 200, o.Payload) } +func (o *PcloudPvminstancesPostOK) GetPayload() models.PVMInstanceList { + return o.Payload +} func (o *PcloudPvminstancesPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -125,7 +117,7 @@ func NewPcloudPvminstancesPostCreated() *PcloudPvminstancesPostCreated { return &PcloudPvminstancesPostCreated{} } -/*PcloudPvminstancesPostCreated handles this case with default header values. +/* PcloudPvminstancesPostCreated describes a response with status code 201, with default header values. Created */ @@ -136,6 +128,9 @@ type PcloudPvminstancesPostCreated struct { func (o *PcloudPvminstancesPostCreated) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances][%d] pcloudPvminstancesPostCreated %+v", 201, o.Payload) } +func (o *PcloudPvminstancesPostCreated) GetPayload() models.PVMInstanceList { + return o.Payload +} func (o *PcloudPvminstancesPostCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -152,7 +147,7 @@ func NewPcloudPvminstancesPostAccepted() *PcloudPvminstancesPostAccepted { return &PcloudPvminstancesPostAccepted{} } -/*PcloudPvminstancesPostAccepted handles this case with default header values. +/* PcloudPvminstancesPostAccepted describes a response with status code 202, with default header values. Accepted */ @@ -163,6 +158,9 @@ type PcloudPvminstancesPostAccepted struct { func (o *PcloudPvminstancesPostAccepted) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances][%d] pcloudPvminstancesPostAccepted %+v", 202, o.Payload) } +func (o *PcloudPvminstancesPostAccepted) GetPayload() models.PVMInstanceList { + return o.Payload +} func (o *PcloudPvminstancesPostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -179,7 +177,7 @@ func NewPcloudPvminstancesPostBadRequest() *PcloudPvminstancesPostBadRequest { return &PcloudPvminstancesPostBadRequest{} } -/*PcloudPvminstancesPostBadRequest handles this case with default header values. +/* PcloudPvminstancesPostBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -190,6 +188,9 @@ type PcloudPvminstancesPostBadRequest struct { func (o *PcloudPvminstancesPostBadRequest) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances][%d] pcloudPvminstancesPostBadRequest %+v", 400, o.Payload) } +func (o *PcloudPvminstancesPostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -208,7 +209,7 @@ func NewPcloudPvminstancesPostUnauthorized() *PcloudPvminstancesPostUnauthorized return &PcloudPvminstancesPostUnauthorized{} } -/*PcloudPvminstancesPostUnauthorized handles this case with default header values. +/* PcloudPvminstancesPostUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -219,6 +220,9 @@ type PcloudPvminstancesPostUnauthorized struct { func (o *PcloudPvminstancesPostUnauthorized) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances][%d] pcloudPvminstancesPostUnauthorized %+v", 401, o.Payload) } +func (o *PcloudPvminstancesPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -237,7 +241,7 @@ func NewPcloudPvminstancesPostConflict() *PcloudPvminstancesPostConflict { return &PcloudPvminstancesPostConflict{} } -/*PcloudPvminstancesPostConflict handles this case with default header values. +/* PcloudPvminstancesPostConflict describes a response with status code 409, with default header values. Conflict */ @@ -248,6 +252,9 @@ type PcloudPvminstancesPostConflict struct { func (o *PcloudPvminstancesPostConflict) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances][%d] pcloudPvminstancesPostConflict %+v", 409, o.Payload) } +func (o *PcloudPvminstancesPostConflict) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesPostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -266,7 +273,7 @@ func NewPcloudPvminstancesPostUnprocessableEntity() *PcloudPvminstancesPostUnpro return &PcloudPvminstancesPostUnprocessableEntity{} } -/*PcloudPvminstancesPostUnprocessableEntity handles this case with default header values. +/* PcloudPvminstancesPostUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -277,6 +284,9 @@ type PcloudPvminstancesPostUnprocessableEntity struct { func (o *PcloudPvminstancesPostUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances][%d] pcloudPvminstancesPostUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudPvminstancesPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesPostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -295,7 +305,7 @@ func NewPcloudPvminstancesPostInternalServerError() *PcloudPvminstancesPostInter return &PcloudPvminstancesPostInternalServerError{} } -/*PcloudPvminstancesPostInternalServerError handles this case with default header values. +/* PcloudPvminstancesPostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -306,6 +316,9 @@ type PcloudPvminstancesPostInternalServerError struct { func (o *PcloudPvminstancesPostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances][%d] pcloudPvminstancesPostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudPvminstancesPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -324,7 +337,7 @@ func NewPcloudPvminstancesPostGatewayTimeout() *PcloudPvminstancesPostGatewayTim return &PcloudPvminstancesPostGatewayTimeout{} } -/*PcloudPvminstancesPostGatewayTimeout handles this case with default header values. +/* PcloudPvminstancesPostGatewayTimeout describes a response with status code 504, with default header values. Gateway Timeout. Request is still processing and taking longer than expected. */ @@ -335,6 +348,9 @@ type PcloudPvminstancesPostGatewayTimeout struct { func (o *PcloudPvminstancesPostGatewayTimeout) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances][%d] pcloudPvminstancesPostGatewayTimeout %+v", 504, o.Payload) } +func (o *PcloudPvminstancesPostGatewayTimeout) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesPostGatewayTimeout) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_put_parameters.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_put_parameters.go index cf5ee58b..48b71a21 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_put_parameters.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_put_parameters.go @@ -13,69 +13,69 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudPvminstancesPutParams creates a new PcloudPvminstancesPutParams object -// with the default values initialized. +// NewPcloudPvminstancesPutParams creates a new PcloudPvminstancesPutParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudPvminstancesPutParams() *PcloudPvminstancesPutParams { - var () return &PcloudPvminstancesPutParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudPvminstancesPutParamsWithTimeout creates a new PcloudPvminstancesPutParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudPvminstancesPutParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesPutParams { - var () return &PcloudPvminstancesPutParams{ - timeout: timeout, } } // NewPcloudPvminstancesPutParamsWithContext creates a new PcloudPvminstancesPutParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudPvminstancesPutParamsWithContext(ctx context.Context) *PcloudPvminstancesPutParams { - var () return &PcloudPvminstancesPutParams{ - Context: ctx, } } // NewPcloudPvminstancesPutParamsWithHTTPClient creates a new PcloudPvminstancesPutParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudPvminstancesPutParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesPutParams { - var () return &PcloudPvminstancesPutParams{ HTTPClient: client, } } -/*PcloudPvminstancesPutParams contains all the parameters to send to the API endpoint -for the pcloud pvminstances put operation typically these are written to a http.Request +/* PcloudPvminstancesPutParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances put operation. + + Typically these are written to a http.Request. */ type PcloudPvminstancesPutParams struct { - /*Body - Parameters to update a PCloud PVM Instance + /* Body. + Parameters to update a PCloud PVM Instance */ Body *models.PVMInstanceUpdate - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*PvmInstanceID - PCloud PVM Instance ID + /* PvmInstanceID. + + PCloud PVM Instance ID */ PvmInstanceID string @@ -84,6 +84,21 @@ type PcloudPvminstancesPutParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud pvminstances put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesPutParams) WithDefaults() *PcloudPvminstancesPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesPutParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud pvminstances put params func (o *PcloudPvminstancesPutParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesPutParams { o.SetTimeout(timeout) @@ -157,7 +172,6 @@ func (o *PcloudPvminstancesPutParams) WriteToRequest(r runtime.ClientRequest, re return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_put_responses.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_put_responses.go index 52186195..c88a794f 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_put_responses.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_put_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudPvminstancesPutReader is a Reader for the PcloudPvminstancesPut structure. @@ -24,44 +23,38 @@ type PcloudPvminstancesPutReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudPvminstancesPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 202: result := NewPcloudPvminstancesPutAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudPvminstancesPutBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudPvminstancesPutUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudPvminstancesPutUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudPvminstancesPutInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudPvminstancesPutAccepted() *PcloudPvminstancesPutAccepted { return &PcloudPvminstancesPutAccepted{} } -/*PcloudPvminstancesPutAccepted handles this case with default header values. +/* PcloudPvminstancesPutAccepted describes a response with status code 202, with default header values. Accepted (this is a long running operation) */ @@ -81,6 +74,9 @@ type PcloudPvminstancesPutAccepted struct { func (o *PcloudPvminstancesPutAccepted) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}][%d] pcloudPvminstancesPutAccepted %+v", 202, o.Payload) } +func (o *PcloudPvminstancesPutAccepted) GetPayload() *models.PVMInstanceUpdateResponse { + return o.Payload +} func (o *PcloudPvminstancesPutAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudPvminstancesPutBadRequest() *PcloudPvminstancesPutBadRequest { return &PcloudPvminstancesPutBadRequest{} } -/*PcloudPvminstancesPutBadRequest handles this case with default header values. +/* PcloudPvminstancesPutBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudPvminstancesPutBadRequest struct { func (o *PcloudPvminstancesPutBadRequest) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}][%d] pcloudPvminstancesPutBadRequest %+v", 400, o.Payload) } +func (o *PcloudPvminstancesPutBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesPutBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudPvminstancesPutUnauthorized() *PcloudPvminstancesPutUnauthorized { return &PcloudPvminstancesPutUnauthorized{} } -/*PcloudPvminstancesPutUnauthorized handles this case with default header values. +/* PcloudPvminstancesPutUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudPvminstancesPutUnauthorized struct { func (o *PcloudPvminstancesPutUnauthorized) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}][%d] pcloudPvminstancesPutUnauthorized %+v", 401, o.Payload) } +func (o *PcloudPvminstancesPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesPutUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudPvminstancesPutUnprocessableEntity() *PcloudPvminstancesPutUnproce return &PcloudPvminstancesPutUnprocessableEntity{} } -/*PcloudPvminstancesPutUnprocessableEntity handles this case with default header values. +/* PcloudPvminstancesPutUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -168,6 +170,9 @@ type PcloudPvminstancesPutUnprocessableEntity struct { func (o *PcloudPvminstancesPutUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}][%d] pcloudPvminstancesPutUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudPvminstancesPutUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesPutUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudPvminstancesPutInternalServerError() *PcloudPvminstancesPutInterna return &PcloudPvminstancesPutInternalServerError{} } -/*PcloudPvminstancesPutInternalServerError handles this case with default header values. +/* PcloudPvminstancesPutInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudPvminstancesPutInternalServerError struct { func (o *PcloudPvminstancesPutInternalServerError) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}][%d] pcloudPvminstancesPutInternalServerError %+v", 500, o.Payload) } +func (o *PcloudPvminstancesPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesPutInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_getall_parameters.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_getall_parameters.go index de156083..6441ed24 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_getall_parameters.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_getall_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudPvminstancesSnapshotsGetallParams creates a new PcloudPvminstancesSnapshotsGetallParams object -// with the default values initialized. +// NewPcloudPvminstancesSnapshotsGetallParams creates a new PcloudPvminstancesSnapshotsGetallParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudPvminstancesSnapshotsGetallParams() *PcloudPvminstancesSnapshotsGetallParams { - var () return &PcloudPvminstancesSnapshotsGetallParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudPvminstancesSnapshotsGetallParamsWithTimeout creates a new PcloudPvminstancesSnapshotsGetallParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudPvminstancesSnapshotsGetallParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesSnapshotsGetallParams { - var () return &PcloudPvminstancesSnapshotsGetallParams{ - timeout: timeout, } } // NewPcloudPvminstancesSnapshotsGetallParamsWithContext creates a new PcloudPvminstancesSnapshotsGetallParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudPvminstancesSnapshotsGetallParamsWithContext(ctx context.Context) *PcloudPvminstancesSnapshotsGetallParams { - var () return &PcloudPvminstancesSnapshotsGetallParams{ - Context: ctx, } } // NewPcloudPvminstancesSnapshotsGetallParamsWithHTTPClient creates a new PcloudPvminstancesSnapshotsGetallParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudPvminstancesSnapshotsGetallParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesSnapshotsGetallParams { - var () return &PcloudPvminstancesSnapshotsGetallParams{ HTTPClient: client, } } -/*PcloudPvminstancesSnapshotsGetallParams contains all the parameters to send to the API endpoint -for the pcloud pvminstances snapshots getall operation typically these are written to a http.Request +/* PcloudPvminstancesSnapshotsGetallParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances snapshots getall operation. + + Typically these are written to a http.Request. */ type PcloudPvminstancesSnapshotsGetallParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*PvmInstanceID - PCloud PVM Instance ID + /* PvmInstanceID. + + PCloud PVM Instance ID */ PvmInstanceID string @@ -77,6 +76,21 @@ type PcloudPvminstancesSnapshotsGetallParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud pvminstances snapshots getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesSnapshotsGetallParams) WithDefaults() *PcloudPvminstancesSnapshotsGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances snapshots getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesSnapshotsGetallParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud pvminstances snapshots getall params func (o *PcloudPvminstancesSnapshotsGetallParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesSnapshotsGetallParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_getall_responses.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_getall_responses.go index 88251dff..9b257b3e 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_getall_responses.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_getall_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudPvminstancesSnapshotsGetallReader is a Reader for the PcloudPvminstancesSnapshotsGetall structure. @@ -24,44 +23,38 @@ type PcloudPvminstancesSnapshotsGetallReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudPvminstancesSnapshotsGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudPvminstancesSnapshotsGetallOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudPvminstancesSnapshotsGetallBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudPvminstancesSnapshotsGetallUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudPvminstancesSnapshotsGetallNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudPvminstancesSnapshotsGetallInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudPvminstancesSnapshotsGetallOK() *PcloudPvminstancesSnapshotsGetall return &PcloudPvminstancesSnapshotsGetallOK{} } -/*PcloudPvminstancesSnapshotsGetallOK handles this case with default header values. +/* PcloudPvminstancesSnapshotsGetallOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudPvminstancesSnapshotsGetallOK struct { func (o *PcloudPvminstancesSnapshotsGetallOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots][%d] pcloudPvminstancesSnapshotsGetallOK %+v", 200, o.Payload) } +func (o *PcloudPvminstancesSnapshotsGetallOK) GetPayload() *models.Snapshots { + return o.Payload +} func (o *PcloudPvminstancesSnapshotsGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudPvminstancesSnapshotsGetallBadRequest() *PcloudPvminstancesSnapsho return &PcloudPvminstancesSnapshotsGetallBadRequest{} } -/*PcloudPvminstancesSnapshotsGetallBadRequest handles this case with default header values. +/* PcloudPvminstancesSnapshotsGetallBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudPvminstancesSnapshotsGetallBadRequest struct { func (o *PcloudPvminstancesSnapshotsGetallBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots][%d] pcloudPvminstancesSnapshotsGetallBadRequest %+v", 400, o.Payload) } +func (o *PcloudPvminstancesSnapshotsGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesSnapshotsGetallBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudPvminstancesSnapshotsGetallUnauthorized() *PcloudPvminstancesSnaps return &PcloudPvminstancesSnapshotsGetallUnauthorized{} } -/*PcloudPvminstancesSnapshotsGetallUnauthorized handles this case with default header values. +/* PcloudPvminstancesSnapshotsGetallUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudPvminstancesSnapshotsGetallUnauthorized struct { func (o *PcloudPvminstancesSnapshotsGetallUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots][%d] pcloudPvminstancesSnapshotsGetallUnauthorized %+v", 401, o.Payload) } +func (o *PcloudPvminstancesSnapshotsGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesSnapshotsGetallUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudPvminstancesSnapshotsGetallNotFound() *PcloudPvminstancesSnapshots return &PcloudPvminstancesSnapshotsGetallNotFound{} } -/*PcloudPvminstancesSnapshotsGetallNotFound handles this case with default header values. +/* PcloudPvminstancesSnapshotsGetallNotFound describes a response with status code 404, with default header values. Not Found */ @@ -168,6 +170,9 @@ type PcloudPvminstancesSnapshotsGetallNotFound struct { func (o *PcloudPvminstancesSnapshotsGetallNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots][%d] pcloudPvminstancesSnapshotsGetallNotFound %+v", 404, o.Payload) } +func (o *PcloudPvminstancesSnapshotsGetallNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesSnapshotsGetallNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudPvminstancesSnapshotsGetallInternalServerError() *PcloudPvminstanc return &PcloudPvminstancesSnapshotsGetallInternalServerError{} } -/*PcloudPvminstancesSnapshotsGetallInternalServerError handles this case with default header values. +/* PcloudPvminstancesSnapshotsGetallInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudPvminstancesSnapshotsGetallInternalServerError struct { func (o *PcloudPvminstancesSnapshotsGetallInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots][%d] pcloudPvminstancesSnapshotsGetallInternalServerError %+v", 500, o.Payload) } +func (o *PcloudPvminstancesSnapshotsGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesSnapshotsGetallInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_post_parameters.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_post_parameters.go index 512b492b..551a20e4 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_post_parameters.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_post_parameters.go @@ -13,69 +13,69 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudPvminstancesSnapshotsPostParams creates a new PcloudPvminstancesSnapshotsPostParams object -// with the default values initialized. +// NewPcloudPvminstancesSnapshotsPostParams creates a new PcloudPvminstancesSnapshotsPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudPvminstancesSnapshotsPostParams() *PcloudPvminstancesSnapshotsPostParams { - var () return &PcloudPvminstancesSnapshotsPostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudPvminstancesSnapshotsPostParamsWithTimeout creates a new PcloudPvminstancesSnapshotsPostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudPvminstancesSnapshotsPostParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesSnapshotsPostParams { - var () return &PcloudPvminstancesSnapshotsPostParams{ - timeout: timeout, } } // NewPcloudPvminstancesSnapshotsPostParamsWithContext creates a new PcloudPvminstancesSnapshotsPostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudPvminstancesSnapshotsPostParamsWithContext(ctx context.Context) *PcloudPvminstancesSnapshotsPostParams { - var () return &PcloudPvminstancesSnapshotsPostParams{ - Context: ctx, } } // NewPcloudPvminstancesSnapshotsPostParamsWithHTTPClient creates a new PcloudPvminstancesSnapshotsPostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudPvminstancesSnapshotsPostParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesSnapshotsPostParams { - var () return &PcloudPvminstancesSnapshotsPostParams{ HTTPClient: client, } } -/*PcloudPvminstancesSnapshotsPostParams contains all the parameters to send to the API endpoint -for the pcloud pvminstances snapshots post operation typically these are written to a http.Request +/* PcloudPvminstancesSnapshotsPostParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances snapshots post operation. + + Typically these are written to a http.Request. */ type PcloudPvminstancesSnapshotsPostParams struct { - /*Body - PVM Instance snapshot create parameters + /* Body. + PVM Instance snapshot create parameters */ Body *models.SnapshotCreate - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*PvmInstanceID - PCloud PVM Instance ID + /* PvmInstanceID. + + PCloud PVM Instance ID */ PvmInstanceID string @@ -84,6 +84,21 @@ type PcloudPvminstancesSnapshotsPostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud pvminstances snapshots post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesSnapshotsPostParams) WithDefaults() *PcloudPvminstancesSnapshotsPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances snapshots post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesSnapshotsPostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud pvminstances snapshots post params func (o *PcloudPvminstancesSnapshotsPostParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesSnapshotsPostParams { o.SetTimeout(timeout) @@ -157,7 +172,6 @@ func (o *PcloudPvminstancesSnapshotsPostParams) WriteToRequest(r runtime.ClientR return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_post_responses.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_post_responses.go index 13f84a95..a1f95722 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_post_responses.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudPvminstancesSnapshotsPostReader is a Reader for the PcloudPvminstancesSnapshotsPost structure. @@ -24,51 +23,44 @@ type PcloudPvminstancesSnapshotsPostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudPvminstancesSnapshotsPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 202: result := NewPcloudPvminstancesSnapshotsPostAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudPvminstancesSnapshotsPostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudPvminstancesSnapshotsPostUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudPvminstancesSnapshotsPostNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 409: result := NewPcloudPvminstancesSnapshotsPostConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudPvminstancesSnapshotsPostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -77,7 +69,7 @@ func NewPcloudPvminstancesSnapshotsPostAccepted() *PcloudPvminstancesSnapshotsPo return &PcloudPvminstancesSnapshotsPostAccepted{} } -/*PcloudPvminstancesSnapshotsPostAccepted handles this case with default header values. +/* PcloudPvminstancesSnapshotsPostAccepted describes a response with status code 202, with default header values. Accepted */ @@ -88,6 +80,9 @@ type PcloudPvminstancesSnapshotsPostAccepted struct { func (o *PcloudPvminstancesSnapshotsPostAccepted) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots][%d] pcloudPvminstancesSnapshotsPostAccepted %+v", 202, o.Payload) } +func (o *PcloudPvminstancesSnapshotsPostAccepted) GetPayload() *models.SnapshotCreateResponse { + return o.Payload +} func (o *PcloudPvminstancesSnapshotsPostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -106,7 +101,7 @@ func NewPcloudPvminstancesSnapshotsPostBadRequest() *PcloudPvminstancesSnapshots return &PcloudPvminstancesSnapshotsPostBadRequest{} } -/*PcloudPvminstancesSnapshotsPostBadRequest handles this case with default header values. +/* PcloudPvminstancesSnapshotsPostBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -117,6 +112,9 @@ type PcloudPvminstancesSnapshotsPostBadRequest struct { func (o *PcloudPvminstancesSnapshotsPostBadRequest) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots][%d] pcloudPvminstancesSnapshotsPostBadRequest %+v", 400, o.Payload) } +func (o *PcloudPvminstancesSnapshotsPostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesSnapshotsPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -135,7 +133,7 @@ func NewPcloudPvminstancesSnapshotsPostUnauthorized() *PcloudPvminstancesSnapsho return &PcloudPvminstancesSnapshotsPostUnauthorized{} } -/*PcloudPvminstancesSnapshotsPostUnauthorized handles this case with default header values. +/* PcloudPvminstancesSnapshotsPostUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -146,6 +144,9 @@ type PcloudPvminstancesSnapshotsPostUnauthorized struct { func (o *PcloudPvminstancesSnapshotsPostUnauthorized) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots][%d] pcloudPvminstancesSnapshotsPostUnauthorized %+v", 401, o.Payload) } +func (o *PcloudPvminstancesSnapshotsPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesSnapshotsPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -164,7 +165,7 @@ func NewPcloudPvminstancesSnapshotsPostNotFound() *PcloudPvminstancesSnapshotsPo return &PcloudPvminstancesSnapshotsPostNotFound{} } -/*PcloudPvminstancesSnapshotsPostNotFound handles this case with default header values. +/* PcloudPvminstancesSnapshotsPostNotFound describes a response with status code 404, with default header values. Not Found */ @@ -175,6 +176,9 @@ type PcloudPvminstancesSnapshotsPostNotFound struct { func (o *PcloudPvminstancesSnapshotsPostNotFound) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots][%d] pcloudPvminstancesSnapshotsPostNotFound %+v", 404, o.Payload) } +func (o *PcloudPvminstancesSnapshotsPostNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesSnapshotsPostNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -193,7 +197,7 @@ func NewPcloudPvminstancesSnapshotsPostConflict() *PcloudPvminstancesSnapshotsPo return &PcloudPvminstancesSnapshotsPostConflict{} } -/*PcloudPvminstancesSnapshotsPostConflict handles this case with default header values. +/* PcloudPvminstancesSnapshotsPostConflict describes a response with status code 409, with default header values. Conflict */ @@ -204,6 +208,9 @@ type PcloudPvminstancesSnapshotsPostConflict struct { func (o *PcloudPvminstancesSnapshotsPostConflict) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots][%d] pcloudPvminstancesSnapshotsPostConflict %+v", 409, o.Payload) } +func (o *PcloudPvminstancesSnapshotsPostConflict) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesSnapshotsPostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -222,7 +229,7 @@ func NewPcloudPvminstancesSnapshotsPostInternalServerError() *PcloudPvminstances return &PcloudPvminstancesSnapshotsPostInternalServerError{} } -/*PcloudPvminstancesSnapshotsPostInternalServerError handles this case with default header values. +/* PcloudPvminstancesSnapshotsPostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -233,6 +240,9 @@ type PcloudPvminstancesSnapshotsPostInternalServerError struct { func (o *PcloudPvminstancesSnapshotsPostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots][%d] pcloudPvminstancesSnapshotsPostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudPvminstancesSnapshotsPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesSnapshotsPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_restore_post_parameters.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_restore_post_parameters.go index bbf792fb..9a56a1f7 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_restore_post_parameters.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_restore_post_parameters.go @@ -13,79 +13,81 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudPvminstancesSnapshotsRestorePostParams creates a new PcloudPvminstancesSnapshotsRestorePostParams object -// with the default values initialized. +// NewPcloudPvminstancesSnapshotsRestorePostParams creates a new PcloudPvminstancesSnapshotsRestorePostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudPvminstancesSnapshotsRestorePostParams() *PcloudPvminstancesSnapshotsRestorePostParams { - var () return &PcloudPvminstancesSnapshotsRestorePostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudPvminstancesSnapshotsRestorePostParamsWithTimeout creates a new PcloudPvminstancesSnapshotsRestorePostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudPvminstancesSnapshotsRestorePostParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesSnapshotsRestorePostParams { - var () return &PcloudPvminstancesSnapshotsRestorePostParams{ - timeout: timeout, } } // NewPcloudPvminstancesSnapshotsRestorePostParamsWithContext creates a new PcloudPvminstancesSnapshotsRestorePostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudPvminstancesSnapshotsRestorePostParamsWithContext(ctx context.Context) *PcloudPvminstancesSnapshotsRestorePostParams { - var () return &PcloudPvminstancesSnapshotsRestorePostParams{ - Context: ctx, } } // NewPcloudPvminstancesSnapshotsRestorePostParamsWithHTTPClient creates a new PcloudPvminstancesSnapshotsRestorePostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudPvminstancesSnapshotsRestorePostParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesSnapshotsRestorePostParams { - var () return &PcloudPvminstancesSnapshotsRestorePostParams{ HTTPClient: client, } } -/*PcloudPvminstancesSnapshotsRestorePostParams contains all the parameters to send to the API endpoint -for the pcloud pvminstances snapshots restore post operation typically these are written to a http.Request +/* PcloudPvminstancesSnapshotsRestorePostParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances snapshots restore post operation. + + Typically these are written to a http.Request. */ type PcloudPvminstancesSnapshotsRestorePostParams struct { - /*Body - PVM Instance snapshot restore parameters + /* Body. + PVM Instance snapshot restore parameters */ Body *models.SnapshotRestore - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*PvmInstanceID - PCloud PVM Instance ID + /* PvmInstanceID. + + PCloud PVM Instance ID */ PvmInstanceID string - /*RestoreFailAction - Action to take on a failed snapshot restore + /* RestoreFailAction. + + Action to take on a failed snapshot restore */ RestoreFailAction *string - /*SnapshotID - PVM Instance snapshot id + /* SnapshotID. + + PVM Instance snapshot id */ SnapshotID string @@ -94,6 +96,21 @@ type PcloudPvminstancesSnapshotsRestorePostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud pvminstances snapshots restore post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesSnapshotsRestorePostParams) WithDefaults() *PcloudPvminstancesSnapshotsRestorePostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances snapshots restore post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesSnapshotsRestorePostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud pvminstances snapshots restore post params func (o *PcloudPvminstancesSnapshotsRestorePostParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesSnapshotsRestorePostParams { o.SetTimeout(timeout) @@ -189,7 +206,6 @@ func (o *PcloudPvminstancesSnapshotsRestorePostParams) WriteToRequest(r runtime. return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err @@ -210,16 +226,17 @@ func (o *PcloudPvminstancesSnapshotsRestorePostParams) WriteToRequest(r runtime. // query param restore_fail_action var qrRestoreFailAction string + if o.RestoreFailAction != nil { qrRestoreFailAction = *o.RestoreFailAction } qRestoreFailAction := qrRestoreFailAction if qRestoreFailAction != "" { + if err := r.SetQueryParam("restore_fail_action", qRestoreFailAction); err != nil { return err } } - } // path param snapshot_id diff --git a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_restore_post_responses.go b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_restore_post_responses.go index bc3d4601..5dbfbac8 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_restore_post_responses.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_restore_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudPvminstancesSnapshotsRestorePostReader is a Reader for the PcloudPvminstancesSnapshotsRestorePost structure. @@ -24,44 +23,38 @@ type PcloudPvminstancesSnapshotsRestorePostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudPvminstancesSnapshotsRestorePostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 202: result := NewPcloudPvminstancesSnapshotsRestorePostAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudPvminstancesSnapshotsRestorePostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudPvminstancesSnapshotsRestorePostUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 409: result := NewPcloudPvminstancesSnapshotsRestorePostConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudPvminstancesSnapshotsRestorePostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudPvminstancesSnapshotsRestorePostAccepted() *PcloudPvminstancesSnap return &PcloudPvminstancesSnapshotsRestorePostAccepted{} } -/*PcloudPvminstancesSnapshotsRestorePostAccepted handles this case with default header values. +/* PcloudPvminstancesSnapshotsRestorePostAccepted describes a response with status code 202, with default header values. Accepted */ @@ -81,6 +74,9 @@ type PcloudPvminstancesSnapshotsRestorePostAccepted struct { func (o *PcloudPvminstancesSnapshotsRestorePostAccepted) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots/{snapshot_id}/restore][%d] pcloudPvminstancesSnapshotsRestorePostAccepted %+v", 202, o.Payload) } +func (o *PcloudPvminstancesSnapshotsRestorePostAccepted) GetPayload() *models.Snapshot { + return o.Payload +} func (o *PcloudPvminstancesSnapshotsRestorePostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudPvminstancesSnapshotsRestorePostBadRequest() *PcloudPvminstancesSn return &PcloudPvminstancesSnapshotsRestorePostBadRequest{} } -/*PcloudPvminstancesSnapshotsRestorePostBadRequest handles this case with default header values. +/* PcloudPvminstancesSnapshotsRestorePostBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudPvminstancesSnapshotsRestorePostBadRequest struct { func (o *PcloudPvminstancesSnapshotsRestorePostBadRequest) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots/{snapshot_id}/restore][%d] pcloudPvminstancesSnapshotsRestorePostBadRequest %+v", 400, o.Payload) } +func (o *PcloudPvminstancesSnapshotsRestorePostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesSnapshotsRestorePostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudPvminstancesSnapshotsRestorePostUnauthorized() *PcloudPvminstances return &PcloudPvminstancesSnapshotsRestorePostUnauthorized{} } -/*PcloudPvminstancesSnapshotsRestorePostUnauthorized handles this case with default header values. +/* PcloudPvminstancesSnapshotsRestorePostUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudPvminstancesSnapshotsRestorePostUnauthorized struct { func (o *PcloudPvminstancesSnapshotsRestorePostUnauthorized) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots/{snapshot_id}/restore][%d] pcloudPvminstancesSnapshotsRestorePostUnauthorized %+v", 401, o.Payload) } +func (o *PcloudPvminstancesSnapshotsRestorePostUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesSnapshotsRestorePostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudPvminstancesSnapshotsRestorePostConflict() *PcloudPvminstancesSnap return &PcloudPvminstancesSnapshotsRestorePostConflict{} } -/*PcloudPvminstancesSnapshotsRestorePostConflict handles this case with default header values. +/* PcloudPvminstancesSnapshotsRestorePostConflict describes a response with status code 409, with default header values. Conflict */ @@ -168,6 +170,9 @@ type PcloudPvminstancesSnapshotsRestorePostConflict struct { func (o *PcloudPvminstancesSnapshotsRestorePostConflict) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots/{snapshot_id}/restore][%d] pcloudPvminstancesSnapshotsRestorePostConflict %+v", 409, o.Payload) } +func (o *PcloudPvminstancesSnapshotsRestorePostConflict) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesSnapshotsRestorePostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudPvminstancesSnapshotsRestorePostInternalServerError() *PcloudPvmin return &PcloudPvminstancesSnapshotsRestorePostInternalServerError{} } -/*PcloudPvminstancesSnapshotsRestorePostInternalServerError handles this case with default header values. +/* PcloudPvminstancesSnapshotsRestorePostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudPvminstancesSnapshotsRestorePostInternalServerError struct { func (o *PcloudPvminstancesSnapshotsRestorePostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots/{snapshot_id}/restore][%d] pcloudPvminstancesSnapshotsRestorePostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudPvminstancesSnapshotsRestorePostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesSnapshotsRestorePostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_p_vm_instances/pcloud_v2_pvminstances_capture_get_parameters.go b/power/client/p_cloud_p_vm_instances/pcloud_v2_pvminstances_capture_get_parameters.go index ecdb5a35..8519057e 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_v2_pvminstances_capture_get_parameters.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_v2_pvminstances_capture_get_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudV2PvminstancesCaptureGetParams creates a new PcloudV2PvminstancesCaptureGetParams object -// with the default values initialized. +// NewPcloudV2PvminstancesCaptureGetParams creates a new PcloudV2PvminstancesCaptureGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudV2PvminstancesCaptureGetParams() *PcloudV2PvminstancesCaptureGetParams { - var () return &PcloudV2PvminstancesCaptureGetParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudV2PvminstancesCaptureGetParamsWithTimeout creates a new PcloudV2PvminstancesCaptureGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudV2PvminstancesCaptureGetParamsWithTimeout(timeout time.Duration) *PcloudV2PvminstancesCaptureGetParams { - var () return &PcloudV2PvminstancesCaptureGetParams{ - timeout: timeout, } } // NewPcloudV2PvminstancesCaptureGetParamsWithContext creates a new PcloudV2PvminstancesCaptureGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudV2PvminstancesCaptureGetParamsWithContext(ctx context.Context) *PcloudV2PvminstancesCaptureGetParams { - var () return &PcloudV2PvminstancesCaptureGetParams{ - Context: ctx, } } // NewPcloudV2PvminstancesCaptureGetParamsWithHTTPClient creates a new PcloudV2PvminstancesCaptureGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudV2PvminstancesCaptureGetParamsWithHTTPClient(client *http.Client) *PcloudV2PvminstancesCaptureGetParams { - var () return &PcloudV2PvminstancesCaptureGetParams{ HTTPClient: client, } } -/*PcloudV2PvminstancesCaptureGetParams contains all the parameters to send to the API endpoint -for the pcloud v2 pvminstances capture get operation typically these are written to a http.Request +/* PcloudV2PvminstancesCaptureGetParams contains all the parameters to send to the API endpoint + for the pcloud v2 pvminstances capture get operation. + + Typically these are written to a http.Request. */ type PcloudV2PvminstancesCaptureGetParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*PvmInstanceID - PCloud PVM Instance ID + /* PvmInstanceID. + + PCloud PVM Instance ID */ PvmInstanceID string @@ -77,6 +76,21 @@ type PcloudV2PvminstancesCaptureGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud v2 pvminstances capture get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2PvminstancesCaptureGetParams) WithDefaults() *PcloudV2PvminstancesCaptureGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v2 pvminstances capture get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2PvminstancesCaptureGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud v2 pvminstances capture get params func (o *PcloudV2PvminstancesCaptureGetParams) WithTimeout(timeout time.Duration) *PcloudV2PvminstancesCaptureGetParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_p_vm_instances/pcloud_v2_pvminstances_capture_get_responses.go b/power/client/p_cloud_p_vm_instances/pcloud_v2_pvminstances_capture_get_responses.go index 8e75093f..d53cfa0b 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_v2_pvminstances_capture_get_responses.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_v2_pvminstances_capture_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudV2PvminstancesCaptureGetReader is a Reader for the PcloudV2PvminstancesCaptureGet structure. @@ -24,37 +23,32 @@ type PcloudV2PvminstancesCaptureGetReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudV2PvminstancesCaptureGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudV2PvminstancesCaptureGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 401: result := NewPcloudV2PvminstancesCaptureGetUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudV2PvminstancesCaptureGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudV2PvminstancesCaptureGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -63,7 +57,7 @@ func NewPcloudV2PvminstancesCaptureGetOK() *PcloudV2PvminstancesCaptureGetOK { return &PcloudV2PvminstancesCaptureGetOK{} } -/*PcloudV2PvminstancesCaptureGetOK handles this case with default header values. +/* PcloudV2PvminstancesCaptureGetOK describes a response with status code 200, with default header values. OK */ @@ -74,6 +68,9 @@ type PcloudV2PvminstancesCaptureGetOK struct { func (o *PcloudV2PvminstancesCaptureGetOK) Error() string { return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture][%d] pcloudV2PvminstancesCaptureGetOK %+v", 200, o.Payload) } +func (o *PcloudV2PvminstancesCaptureGetOK) GetPayload() *models.Job { + return o.Payload +} func (o *PcloudV2PvminstancesCaptureGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -92,7 +89,7 @@ func NewPcloudV2PvminstancesCaptureGetUnauthorized() *PcloudV2PvminstancesCaptur return &PcloudV2PvminstancesCaptureGetUnauthorized{} } -/*PcloudV2PvminstancesCaptureGetUnauthorized handles this case with default header values. +/* PcloudV2PvminstancesCaptureGetUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -103,6 +100,9 @@ type PcloudV2PvminstancesCaptureGetUnauthorized struct { func (o *PcloudV2PvminstancesCaptureGetUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture][%d] pcloudV2PvminstancesCaptureGetUnauthorized %+v", 401, o.Payload) } +func (o *PcloudV2PvminstancesCaptureGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2PvminstancesCaptureGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -121,7 +121,7 @@ func NewPcloudV2PvminstancesCaptureGetNotFound() *PcloudV2PvminstancesCaptureGet return &PcloudV2PvminstancesCaptureGetNotFound{} } -/*PcloudV2PvminstancesCaptureGetNotFound handles this case with default header values. +/* PcloudV2PvminstancesCaptureGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -132,6 +132,9 @@ type PcloudV2PvminstancesCaptureGetNotFound struct { func (o *PcloudV2PvminstancesCaptureGetNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture][%d] pcloudV2PvminstancesCaptureGetNotFound %+v", 404, o.Payload) } +func (o *PcloudV2PvminstancesCaptureGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2PvminstancesCaptureGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -150,7 +153,7 @@ func NewPcloudV2PvminstancesCaptureGetInternalServerError() *PcloudV2Pvminstance return &PcloudV2PvminstancesCaptureGetInternalServerError{} } -/*PcloudV2PvminstancesCaptureGetInternalServerError handles this case with default header values. +/* PcloudV2PvminstancesCaptureGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -161,6 +164,9 @@ type PcloudV2PvminstancesCaptureGetInternalServerError struct { func (o *PcloudV2PvminstancesCaptureGetInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture][%d] pcloudV2PvminstancesCaptureGetInternalServerError %+v", 500, o.Payload) } +func (o *PcloudV2PvminstancesCaptureGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2PvminstancesCaptureGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_p_vm_instances/pcloud_v2_pvminstances_capture_post_parameters.go b/power/client/p_cloud_p_vm_instances/pcloud_v2_pvminstances_capture_post_parameters.go index 134e6edb..2a09a266 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_v2_pvminstances_capture_post_parameters.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_v2_pvminstances_capture_post_parameters.go @@ -13,69 +13,69 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudV2PvminstancesCapturePostParams creates a new PcloudV2PvminstancesCapturePostParams object -// with the default values initialized. +// NewPcloudV2PvminstancesCapturePostParams creates a new PcloudV2PvminstancesCapturePostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudV2PvminstancesCapturePostParams() *PcloudV2PvminstancesCapturePostParams { - var () return &PcloudV2PvminstancesCapturePostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudV2PvminstancesCapturePostParamsWithTimeout creates a new PcloudV2PvminstancesCapturePostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudV2PvminstancesCapturePostParamsWithTimeout(timeout time.Duration) *PcloudV2PvminstancesCapturePostParams { - var () return &PcloudV2PvminstancesCapturePostParams{ - timeout: timeout, } } // NewPcloudV2PvminstancesCapturePostParamsWithContext creates a new PcloudV2PvminstancesCapturePostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudV2PvminstancesCapturePostParamsWithContext(ctx context.Context) *PcloudV2PvminstancesCapturePostParams { - var () return &PcloudV2PvminstancesCapturePostParams{ - Context: ctx, } } // NewPcloudV2PvminstancesCapturePostParamsWithHTTPClient creates a new PcloudV2PvminstancesCapturePostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudV2PvminstancesCapturePostParamsWithHTTPClient(client *http.Client) *PcloudV2PvminstancesCapturePostParams { - var () return &PcloudV2PvminstancesCapturePostParams{ HTTPClient: client, } } -/*PcloudV2PvminstancesCapturePostParams contains all the parameters to send to the API endpoint -for the pcloud v2 pvminstances capture post operation typically these are written to a http.Request +/* PcloudV2PvminstancesCapturePostParams contains all the parameters to send to the API endpoint + for the pcloud v2 pvminstances capture post operation. + + Typically these are written to a http.Request. */ type PcloudV2PvminstancesCapturePostParams struct { - /*Body - Parameters for the capture + /* Body. + Parameters for the capture */ Body *models.PVMInstanceCapture - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*PvmInstanceID - PCloud PVM Instance ID + /* PvmInstanceID. + + PCloud PVM Instance ID */ PvmInstanceID string @@ -84,6 +84,21 @@ type PcloudV2PvminstancesCapturePostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud v2 pvminstances capture post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2PvminstancesCapturePostParams) WithDefaults() *PcloudV2PvminstancesCapturePostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v2 pvminstances capture post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2PvminstancesCapturePostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud v2 pvminstances capture post params func (o *PcloudV2PvminstancesCapturePostParams) WithTimeout(timeout time.Duration) *PcloudV2PvminstancesCapturePostParams { o.SetTimeout(timeout) @@ -157,7 +172,6 @@ func (o *PcloudV2PvminstancesCapturePostParams) WriteToRequest(r runtime.ClientR return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_p_vm_instances/pcloud_v2_pvminstances_capture_post_responses.go b/power/client/p_cloud_p_vm_instances/pcloud_v2_pvminstances_capture_post_responses.go index 88b23e38..787b81fa 100644 --- a/power/client/p_cloud_p_vm_instances/pcloud_v2_pvminstances_capture_post_responses.go +++ b/power/client/p_cloud_p_vm_instances/pcloud_v2_pvminstances_capture_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudV2PvminstancesCapturePostReader is a Reader for the PcloudV2PvminstancesCapturePost structure. @@ -24,58 +23,50 @@ type PcloudV2PvminstancesCapturePostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudV2PvminstancesCapturePostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 202: result := NewPcloudV2PvminstancesCapturePostAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudV2PvminstancesCapturePostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudV2PvminstancesCapturePostUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudV2PvminstancesCapturePostNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 409: result := NewPcloudV2PvminstancesCapturePostConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudV2PvminstancesCapturePostUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudV2PvminstancesCapturePostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -84,7 +75,7 @@ func NewPcloudV2PvminstancesCapturePostAccepted() *PcloudV2PvminstancesCapturePo return &PcloudV2PvminstancesCapturePostAccepted{} } -/*PcloudV2PvminstancesCapturePostAccepted handles this case with default header values. +/* PcloudV2PvminstancesCapturePostAccepted describes a response with status code 202, with default header values. Accepted, pvm-instance capture successfully added to the jobs queue */ @@ -95,6 +86,9 @@ type PcloudV2PvminstancesCapturePostAccepted struct { func (o *PcloudV2PvminstancesCapturePostAccepted) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture][%d] pcloudV2PvminstancesCapturePostAccepted %+v", 202, o.Payload) } +func (o *PcloudV2PvminstancesCapturePostAccepted) GetPayload() *models.JobReference { + return o.Payload +} func (o *PcloudV2PvminstancesCapturePostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -113,7 +107,7 @@ func NewPcloudV2PvminstancesCapturePostBadRequest() *PcloudV2PvminstancesCapture return &PcloudV2PvminstancesCapturePostBadRequest{} } -/*PcloudV2PvminstancesCapturePostBadRequest handles this case with default header values. +/* PcloudV2PvminstancesCapturePostBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -124,6 +118,9 @@ type PcloudV2PvminstancesCapturePostBadRequest struct { func (o *PcloudV2PvminstancesCapturePostBadRequest) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture][%d] pcloudV2PvminstancesCapturePostBadRequest %+v", 400, o.Payload) } +func (o *PcloudV2PvminstancesCapturePostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2PvminstancesCapturePostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -142,7 +139,7 @@ func NewPcloudV2PvminstancesCapturePostUnauthorized() *PcloudV2PvminstancesCaptu return &PcloudV2PvminstancesCapturePostUnauthorized{} } -/*PcloudV2PvminstancesCapturePostUnauthorized handles this case with default header values. +/* PcloudV2PvminstancesCapturePostUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -153,6 +150,9 @@ type PcloudV2PvminstancesCapturePostUnauthorized struct { func (o *PcloudV2PvminstancesCapturePostUnauthorized) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture][%d] pcloudV2PvminstancesCapturePostUnauthorized %+v", 401, o.Payload) } +func (o *PcloudV2PvminstancesCapturePostUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2PvminstancesCapturePostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -171,7 +171,7 @@ func NewPcloudV2PvminstancesCapturePostNotFound() *PcloudV2PvminstancesCapturePo return &PcloudV2PvminstancesCapturePostNotFound{} } -/*PcloudV2PvminstancesCapturePostNotFound handles this case with default header values. +/* PcloudV2PvminstancesCapturePostNotFound describes a response with status code 404, with default header values. pvm instance id not found */ @@ -182,6 +182,9 @@ type PcloudV2PvminstancesCapturePostNotFound struct { func (o *PcloudV2PvminstancesCapturePostNotFound) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture][%d] pcloudV2PvminstancesCapturePostNotFound %+v", 404, o.Payload) } +func (o *PcloudV2PvminstancesCapturePostNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2PvminstancesCapturePostNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -200,7 +203,7 @@ func NewPcloudV2PvminstancesCapturePostConflict() *PcloudV2PvminstancesCapturePo return &PcloudV2PvminstancesCapturePostConflict{} } -/*PcloudV2PvminstancesCapturePostConflict handles this case with default header values. +/* PcloudV2PvminstancesCapturePostConflict describes a response with status code 409, with default header values. Conflict, a conflict has prevented adding the pvm-instance capture job */ @@ -211,6 +214,9 @@ type PcloudV2PvminstancesCapturePostConflict struct { func (o *PcloudV2PvminstancesCapturePostConflict) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture][%d] pcloudV2PvminstancesCapturePostConflict %+v", 409, o.Payload) } +func (o *PcloudV2PvminstancesCapturePostConflict) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2PvminstancesCapturePostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -229,7 +235,7 @@ func NewPcloudV2PvminstancesCapturePostUnprocessableEntity() *PcloudV2Pvminstanc return &PcloudV2PvminstancesCapturePostUnprocessableEntity{} } -/*PcloudV2PvminstancesCapturePostUnprocessableEntity handles this case with default header values. +/* PcloudV2PvminstancesCapturePostUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -240,6 +246,9 @@ type PcloudV2PvminstancesCapturePostUnprocessableEntity struct { func (o *PcloudV2PvminstancesCapturePostUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture][%d] pcloudV2PvminstancesCapturePostUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudV2PvminstancesCapturePostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2PvminstancesCapturePostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -258,7 +267,7 @@ func NewPcloudV2PvminstancesCapturePostInternalServerError() *PcloudV2Pvminstanc return &PcloudV2PvminstancesCapturePostInternalServerError{} } -/*PcloudV2PvminstancesCapturePostInternalServerError handles this case with default header values. +/* PcloudV2PvminstancesCapturePostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -269,6 +278,9 @@ type PcloudV2PvminstancesCapturePostInternalServerError struct { func (o *PcloudV2PvminstancesCapturePostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture][%d] pcloudV2PvminstancesCapturePostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudV2PvminstancesCapturePostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2PvminstancesCapturePostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_placement_groups/p_cloud_placement_groups_client.go b/power/client/p_cloud_placement_groups/p_cloud_placement_groups_client.go index 9f71199f..85828def 100644 --- a/power/client/p_cloud_placement_groups/p_cloud_placement_groups_client.go +++ b/power/client/p_cloud_placement_groups/p_cloud_placement_groups_client.go @@ -6,13 +6,14 @@ package p_cloud_placement_groups // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/runtime" + "fmt" - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" ) // New creates a new p cloud placement groups API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { return &Client{transport: transport, formats: formats} } @@ -24,16 +25,35 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudPlacementgroupsDelete(params *PcloudPlacementgroupsDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPlacementgroupsDeleteOK, error) + + PcloudPlacementgroupsGet(params *PcloudPlacementgroupsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPlacementgroupsGetOK, error) + + PcloudPlacementgroupsGetall(params *PcloudPlacementgroupsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPlacementgroupsGetallOK, error) + + PcloudPlacementgroupsMembersDelete(params *PcloudPlacementgroupsMembersDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPlacementgroupsMembersDeleteOK, error) + + PcloudPlacementgroupsMembersPost(params *PcloudPlacementgroupsMembersPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPlacementgroupsMembersPostOK, error) + + PcloudPlacementgroupsPost(params *PcloudPlacementgroupsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPlacementgroupsPostOK, error) + + SetTransport(transport runtime.ClientTransport) +} + /* -PcloudPlacementgroupsDelete deletes server placement group + PcloudPlacementgroupsDelete deletes server placement group */ -func (a *Client) PcloudPlacementgroupsDelete(params *PcloudPlacementgroupsDeleteParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudPlacementgroupsDeleteOK, error) { +func (a *Client) PcloudPlacementgroupsDelete(params *PcloudPlacementgroupsDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPlacementgroupsDeleteOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudPlacementgroupsDeleteParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.placementgroups.delete", Method: "DELETE", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}", @@ -45,24 +65,34 @@ func (a *Client) PcloudPlacementgroupsDelete(params *PcloudPlacementgroupsDelete AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudPlacementgroupsDeleteOK), nil - + success, ok := result.(*PcloudPlacementgroupsDeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.placementgroups.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudPlacementgroupsGet gets server placement group detail + PcloudPlacementgroupsGet gets server placement group detail */ -func (a *Client) PcloudPlacementgroupsGet(params *PcloudPlacementgroupsGetParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudPlacementgroupsGetOK, error) { +func (a *Client) PcloudPlacementgroupsGet(params *PcloudPlacementgroupsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPlacementgroupsGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudPlacementgroupsGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.placementgroups.get", Method: "GET", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}", @@ -74,24 +104,34 @@ func (a *Client) PcloudPlacementgroupsGet(params *PcloudPlacementgroupsGetParams AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudPlacementgroupsGetOK), nil - + success, ok := result.(*PcloudPlacementgroupsGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.placementgroups.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudPlacementgroupsGetall gets all server placement groups + PcloudPlacementgroupsGetall gets all server placement groups */ -func (a *Client) PcloudPlacementgroupsGetall(params *PcloudPlacementgroupsGetallParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudPlacementgroupsGetallOK, error) { +func (a *Client) PcloudPlacementgroupsGetall(params *PcloudPlacementgroupsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPlacementgroupsGetallOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudPlacementgroupsGetallParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.placementgroups.getall", Method: "GET", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups", @@ -103,24 +143,34 @@ func (a *Client) PcloudPlacementgroupsGetall(params *PcloudPlacementgroupsGetall AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudPlacementgroupsGetallOK), nil - + success, ok := result.(*PcloudPlacementgroupsGetallOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.placementgroups.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudPlacementgroupsMembersDelete removes server from placement group + PcloudPlacementgroupsMembersDelete removes server from placement group */ -func (a *Client) PcloudPlacementgroupsMembersDelete(params *PcloudPlacementgroupsMembersDeleteParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudPlacementgroupsMembersDeleteOK, error) { +func (a *Client) PcloudPlacementgroupsMembersDelete(params *PcloudPlacementgroupsMembersDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPlacementgroupsMembersDeleteOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudPlacementgroupsMembersDeleteParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.placementgroups.members.delete", Method: "DELETE", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}/members", @@ -132,24 +182,34 @@ func (a *Client) PcloudPlacementgroupsMembersDelete(params *PcloudPlacementgroup AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudPlacementgroupsMembersDeleteOK), nil - + success, ok := result.(*PcloudPlacementgroupsMembersDeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.placementgroups.members.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudPlacementgroupsMembersPost adds server to placement group + PcloudPlacementgroupsMembersPost adds server to placement group */ -func (a *Client) PcloudPlacementgroupsMembersPost(params *PcloudPlacementgroupsMembersPostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudPlacementgroupsMembersPostOK, error) { +func (a *Client) PcloudPlacementgroupsMembersPost(params *PcloudPlacementgroupsMembersPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPlacementgroupsMembersPostOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudPlacementgroupsMembersPostParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.placementgroups.members.post", Method: "POST", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}/members", @@ -161,24 +221,34 @@ func (a *Client) PcloudPlacementgroupsMembersPost(params *PcloudPlacementgroupsM AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudPlacementgroupsMembersPostOK), nil - + success, ok := result.(*PcloudPlacementgroupsMembersPostOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.placementgroups.members.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudPlacementgroupsPost creates a new server placement group + PcloudPlacementgroupsPost creates a new server placement group */ -func (a *Client) PcloudPlacementgroupsPost(params *PcloudPlacementgroupsPostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudPlacementgroupsPostOK, error) { +func (a *Client) PcloudPlacementgroupsPost(params *PcloudPlacementgroupsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPlacementgroupsPostOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudPlacementgroupsPostParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.placementgroups.post", Method: "POST", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups", @@ -190,12 +260,23 @@ func (a *Client) PcloudPlacementgroupsPost(params *PcloudPlacementgroupsPostPara AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudPlacementgroupsPostOK), nil - + success, ok := result.(*PcloudPlacementgroupsPostOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.placementgroups.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } // SetTransport changes the transport on the client diff --git a/power/client/p_cloud_placement_groups/pcloud_placementgroups_delete_parameters.go b/power/client/p_cloud_placement_groups/pcloud_placementgroups_delete_parameters.go index e89a5ab0..a81176ab 100644 --- a/power/client/p_cloud_placement_groups/pcloud_placementgroups_delete_parameters.go +++ b/power/client/p_cloud_placement_groups/pcloud_placementgroups_delete_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudPlacementgroupsDeleteParams creates a new PcloudPlacementgroupsDeleteParams object -// with the default values initialized. +// NewPcloudPlacementgroupsDeleteParams creates a new PcloudPlacementgroupsDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudPlacementgroupsDeleteParams() *PcloudPlacementgroupsDeleteParams { - var () return &PcloudPlacementgroupsDeleteParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudPlacementgroupsDeleteParamsWithTimeout creates a new PcloudPlacementgroupsDeleteParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudPlacementgroupsDeleteParamsWithTimeout(timeout time.Duration) *PcloudPlacementgroupsDeleteParams { - var () return &PcloudPlacementgroupsDeleteParams{ - timeout: timeout, } } // NewPcloudPlacementgroupsDeleteParamsWithContext creates a new PcloudPlacementgroupsDeleteParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudPlacementgroupsDeleteParamsWithContext(ctx context.Context) *PcloudPlacementgroupsDeleteParams { - var () return &PcloudPlacementgroupsDeleteParams{ - Context: ctx, } } // NewPcloudPlacementgroupsDeleteParamsWithHTTPClient creates a new PcloudPlacementgroupsDeleteParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudPlacementgroupsDeleteParamsWithHTTPClient(client *http.Client) *PcloudPlacementgroupsDeleteParams { - var () return &PcloudPlacementgroupsDeleteParams{ HTTPClient: client, } } -/*PcloudPlacementgroupsDeleteParams contains all the parameters to send to the API endpoint -for the pcloud placementgroups delete operation typically these are written to a http.Request +/* PcloudPlacementgroupsDeleteParams contains all the parameters to send to the API endpoint + for the pcloud placementgroups delete operation. + + Typically these are written to a http.Request. */ type PcloudPlacementgroupsDeleteParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*PlacementGroupID - Placement Group ID + /* PlacementGroupID. + + Placement Group ID */ PlacementGroupID string @@ -77,6 +76,21 @@ type PcloudPlacementgroupsDeleteParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud placementgroups delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPlacementgroupsDeleteParams) WithDefaults() *PcloudPlacementgroupsDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud placementgroups delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPlacementgroupsDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud placementgroups delete params func (o *PcloudPlacementgroupsDeleteParams) WithTimeout(timeout time.Duration) *PcloudPlacementgroupsDeleteParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_placement_groups/pcloud_placementgroups_delete_responses.go b/power/client/p_cloud_placement_groups/pcloud_placementgroups_delete_responses.go index fac91ef8..7052f606 100644 --- a/power/client/p_cloud_placement_groups/pcloud_placementgroups_delete_responses.go +++ b/power/client/p_cloud_placement_groups/pcloud_placementgroups_delete_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudPlacementgroupsDeleteReader is a Reader for the PcloudPlacementgroupsDelete structure. @@ -24,37 +23,32 @@ type PcloudPlacementgroupsDeleteReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudPlacementgroupsDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudPlacementgroupsDeleteOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudPlacementgroupsDeleteBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudPlacementgroupsDeleteNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudPlacementgroupsDeleteInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -63,7 +57,7 @@ func NewPcloudPlacementgroupsDeleteOK() *PcloudPlacementgroupsDeleteOK { return &PcloudPlacementgroupsDeleteOK{} } -/*PcloudPlacementgroupsDeleteOK handles this case with default header values. +/* PcloudPlacementgroupsDeleteOK describes a response with status code 200, with default header values. OK */ @@ -74,6 +68,9 @@ type PcloudPlacementgroupsDeleteOK struct { func (o *PcloudPlacementgroupsDeleteOK) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}][%d] pcloudPlacementgroupsDeleteOK %+v", 200, o.Payload) } +func (o *PcloudPlacementgroupsDeleteOK) GetPayload() models.Object { + return o.Payload +} func (o *PcloudPlacementgroupsDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -90,7 +87,7 @@ func NewPcloudPlacementgroupsDeleteBadRequest() *PcloudPlacementgroupsDeleteBadR return &PcloudPlacementgroupsDeleteBadRequest{} } -/*PcloudPlacementgroupsDeleteBadRequest handles this case with default header values. +/* PcloudPlacementgroupsDeleteBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -101,6 +98,9 @@ type PcloudPlacementgroupsDeleteBadRequest struct { func (o *PcloudPlacementgroupsDeleteBadRequest) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}][%d] pcloudPlacementgroupsDeleteBadRequest %+v", 400, o.Payload) } +func (o *PcloudPlacementgroupsDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPlacementgroupsDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -119,7 +119,7 @@ func NewPcloudPlacementgroupsDeleteNotFound() *PcloudPlacementgroupsDeleteNotFou return &PcloudPlacementgroupsDeleteNotFound{} } -/*PcloudPlacementgroupsDeleteNotFound handles this case with default header values. +/* PcloudPlacementgroupsDeleteNotFound describes a response with status code 404, with default header values. Not Found */ @@ -130,6 +130,9 @@ type PcloudPlacementgroupsDeleteNotFound struct { func (o *PcloudPlacementgroupsDeleteNotFound) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}][%d] pcloudPlacementgroupsDeleteNotFound %+v", 404, o.Payload) } +func (o *PcloudPlacementgroupsDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPlacementgroupsDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -148,7 +151,7 @@ func NewPcloudPlacementgroupsDeleteInternalServerError() *PcloudPlacementgroupsD return &PcloudPlacementgroupsDeleteInternalServerError{} } -/*PcloudPlacementgroupsDeleteInternalServerError handles this case with default header values. +/* PcloudPlacementgroupsDeleteInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -159,6 +162,9 @@ type PcloudPlacementgroupsDeleteInternalServerError struct { func (o *PcloudPlacementgroupsDeleteInternalServerError) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}][%d] pcloudPlacementgroupsDeleteInternalServerError %+v", 500, o.Payload) } +func (o *PcloudPlacementgroupsDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPlacementgroupsDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_placement_groups/pcloud_placementgroups_get_parameters.go b/power/client/p_cloud_placement_groups/pcloud_placementgroups_get_parameters.go index d03aeb44..7c9106fc 100644 --- a/power/client/p_cloud_placement_groups/pcloud_placementgroups_get_parameters.go +++ b/power/client/p_cloud_placement_groups/pcloud_placementgroups_get_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudPlacementgroupsGetParams creates a new PcloudPlacementgroupsGetParams object -// with the default values initialized. +// NewPcloudPlacementgroupsGetParams creates a new PcloudPlacementgroupsGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudPlacementgroupsGetParams() *PcloudPlacementgroupsGetParams { - var () return &PcloudPlacementgroupsGetParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudPlacementgroupsGetParamsWithTimeout creates a new PcloudPlacementgroupsGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudPlacementgroupsGetParamsWithTimeout(timeout time.Duration) *PcloudPlacementgroupsGetParams { - var () return &PcloudPlacementgroupsGetParams{ - timeout: timeout, } } // NewPcloudPlacementgroupsGetParamsWithContext creates a new PcloudPlacementgroupsGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudPlacementgroupsGetParamsWithContext(ctx context.Context) *PcloudPlacementgroupsGetParams { - var () return &PcloudPlacementgroupsGetParams{ - Context: ctx, } } // NewPcloudPlacementgroupsGetParamsWithHTTPClient creates a new PcloudPlacementgroupsGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudPlacementgroupsGetParamsWithHTTPClient(client *http.Client) *PcloudPlacementgroupsGetParams { - var () return &PcloudPlacementgroupsGetParams{ HTTPClient: client, } } -/*PcloudPlacementgroupsGetParams contains all the parameters to send to the API endpoint -for the pcloud placementgroups get operation typically these are written to a http.Request +/* PcloudPlacementgroupsGetParams contains all the parameters to send to the API endpoint + for the pcloud placementgroups get operation. + + Typically these are written to a http.Request. */ type PcloudPlacementgroupsGetParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*PlacementGroupID - Placement Group ID + /* PlacementGroupID. + + Placement Group ID */ PlacementGroupID string @@ -77,6 +76,21 @@ type PcloudPlacementgroupsGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud placementgroups get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPlacementgroupsGetParams) WithDefaults() *PcloudPlacementgroupsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud placementgroups get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPlacementgroupsGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud placementgroups get params func (o *PcloudPlacementgroupsGetParams) WithTimeout(timeout time.Duration) *PcloudPlacementgroupsGetParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_placement_groups/pcloud_placementgroups_get_responses.go b/power/client/p_cloud_placement_groups/pcloud_placementgroups_get_responses.go index 6b42b7ce..8a3a7acf 100644 --- a/power/client/p_cloud_placement_groups/pcloud_placementgroups_get_responses.go +++ b/power/client/p_cloud_placement_groups/pcloud_placementgroups_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudPlacementgroupsGetReader is a Reader for the PcloudPlacementgroupsGet structure. @@ -24,37 +23,32 @@ type PcloudPlacementgroupsGetReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudPlacementgroupsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudPlacementgroupsGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudPlacementgroupsGetBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudPlacementgroupsGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudPlacementgroupsGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -63,7 +57,7 @@ func NewPcloudPlacementgroupsGetOK() *PcloudPlacementgroupsGetOK { return &PcloudPlacementgroupsGetOK{} } -/*PcloudPlacementgroupsGetOK handles this case with default header values. +/* PcloudPlacementgroupsGetOK describes a response with status code 200, with default header values. OK */ @@ -74,6 +68,9 @@ type PcloudPlacementgroupsGetOK struct { func (o *PcloudPlacementgroupsGetOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}][%d] pcloudPlacementgroupsGetOK %+v", 200, o.Payload) } +func (o *PcloudPlacementgroupsGetOK) GetPayload() *models.PlacementGroup { + return o.Payload +} func (o *PcloudPlacementgroupsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -92,7 +89,7 @@ func NewPcloudPlacementgroupsGetBadRequest() *PcloudPlacementgroupsGetBadRequest return &PcloudPlacementgroupsGetBadRequest{} } -/*PcloudPlacementgroupsGetBadRequest handles this case with default header values. +/* PcloudPlacementgroupsGetBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -103,6 +100,9 @@ type PcloudPlacementgroupsGetBadRequest struct { func (o *PcloudPlacementgroupsGetBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}][%d] pcloudPlacementgroupsGetBadRequest %+v", 400, o.Payload) } +func (o *PcloudPlacementgroupsGetBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPlacementgroupsGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -121,7 +121,7 @@ func NewPcloudPlacementgroupsGetNotFound() *PcloudPlacementgroupsGetNotFound { return &PcloudPlacementgroupsGetNotFound{} } -/*PcloudPlacementgroupsGetNotFound handles this case with default header values. +/* PcloudPlacementgroupsGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -132,6 +132,9 @@ type PcloudPlacementgroupsGetNotFound struct { func (o *PcloudPlacementgroupsGetNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}][%d] pcloudPlacementgroupsGetNotFound %+v", 404, o.Payload) } +func (o *PcloudPlacementgroupsGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPlacementgroupsGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -150,7 +153,7 @@ func NewPcloudPlacementgroupsGetInternalServerError() *PcloudPlacementgroupsGetI return &PcloudPlacementgroupsGetInternalServerError{} } -/*PcloudPlacementgroupsGetInternalServerError handles this case with default header values. +/* PcloudPlacementgroupsGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -161,6 +164,9 @@ type PcloudPlacementgroupsGetInternalServerError struct { func (o *PcloudPlacementgroupsGetInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}][%d] pcloudPlacementgroupsGetInternalServerError %+v", 500, o.Payload) } +func (o *PcloudPlacementgroupsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPlacementgroupsGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_placement_groups/pcloud_placementgroups_getall_parameters.go b/power/client/p_cloud_placement_groups/pcloud_placementgroups_getall_parameters.go index 01279c2d..07366c2d 100644 --- a/power/client/p_cloud_placement_groups/pcloud_placementgroups_getall_parameters.go +++ b/power/client/p_cloud_placement_groups/pcloud_placementgroups_getall_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudPlacementgroupsGetallParams creates a new PcloudPlacementgroupsGetallParams object -// with the default values initialized. +// NewPcloudPlacementgroupsGetallParams creates a new PcloudPlacementgroupsGetallParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudPlacementgroupsGetallParams() *PcloudPlacementgroupsGetallParams { - var () return &PcloudPlacementgroupsGetallParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudPlacementgroupsGetallParamsWithTimeout creates a new PcloudPlacementgroupsGetallParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudPlacementgroupsGetallParamsWithTimeout(timeout time.Duration) *PcloudPlacementgroupsGetallParams { - var () return &PcloudPlacementgroupsGetallParams{ - timeout: timeout, } } // NewPcloudPlacementgroupsGetallParamsWithContext creates a new PcloudPlacementgroupsGetallParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudPlacementgroupsGetallParamsWithContext(ctx context.Context) *PcloudPlacementgroupsGetallParams { - var () return &PcloudPlacementgroupsGetallParams{ - Context: ctx, } } // NewPcloudPlacementgroupsGetallParamsWithHTTPClient creates a new PcloudPlacementgroupsGetallParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudPlacementgroupsGetallParamsWithHTTPClient(client *http.Client) *PcloudPlacementgroupsGetallParams { - var () return &PcloudPlacementgroupsGetallParams{ HTTPClient: client, } } -/*PcloudPlacementgroupsGetallParams contains all the parameters to send to the API endpoint -for the pcloud placementgroups getall operation typically these are written to a http.Request +/* PcloudPlacementgroupsGetallParams contains all the parameters to send to the API endpoint + for the pcloud placementgroups getall operation. + + Typically these are written to a http.Request. */ type PcloudPlacementgroupsGetallParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -72,6 +70,21 @@ type PcloudPlacementgroupsGetallParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud placementgroups getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPlacementgroupsGetallParams) WithDefaults() *PcloudPlacementgroupsGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud placementgroups getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPlacementgroupsGetallParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud placementgroups getall params func (o *PcloudPlacementgroupsGetallParams) WithTimeout(timeout time.Duration) *PcloudPlacementgroupsGetallParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_placement_groups/pcloud_placementgroups_getall_responses.go b/power/client/p_cloud_placement_groups/pcloud_placementgroups_getall_responses.go index f792a524..7263ac5f 100644 --- a/power/client/p_cloud_placement_groups/pcloud_placementgroups_getall_responses.go +++ b/power/client/p_cloud_placement_groups/pcloud_placementgroups_getall_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudPlacementgroupsGetallReader is a Reader for the PcloudPlacementgroupsGetall structure. @@ -24,37 +23,32 @@ type PcloudPlacementgroupsGetallReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudPlacementgroupsGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudPlacementgroupsGetallOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudPlacementgroupsGetallBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudPlacementgroupsGetallUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudPlacementgroupsGetallInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -63,7 +57,7 @@ func NewPcloudPlacementgroupsGetallOK() *PcloudPlacementgroupsGetallOK { return &PcloudPlacementgroupsGetallOK{} } -/*PcloudPlacementgroupsGetallOK handles this case with default header values. +/* PcloudPlacementgroupsGetallOK describes a response with status code 200, with default header values. OK */ @@ -74,6 +68,9 @@ type PcloudPlacementgroupsGetallOK struct { func (o *PcloudPlacementgroupsGetallOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups][%d] pcloudPlacementgroupsGetallOK %+v", 200, o.Payload) } +func (o *PcloudPlacementgroupsGetallOK) GetPayload() *models.PlacementGroups { + return o.Payload +} func (o *PcloudPlacementgroupsGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -92,7 +89,7 @@ func NewPcloudPlacementgroupsGetallBadRequest() *PcloudPlacementgroupsGetallBadR return &PcloudPlacementgroupsGetallBadRequest{} } -/*PcloudPlacementgroupsGetallBadRequest handles this case with default header values. +/* PcloudPlacementgroupsGetallBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -103,6 +100,9 @@ type PcloudPlacementgroupsGetallBadRequest struct { func (o *PcloudPlacementgroupsGetallBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups][%d] pcloudPlacementgroupsGetallBadRequest %+v", 400, o.Payload) } +func (o *PcloudPlacementgroupsGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPlacementgroupsGetallBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -121,7 +121,7 @@ func NewPcloudPlacementgroupsGetallUnauthorized() *PcloudPlacementgroupsGetallUn return &PcloudPlacementgroupsGetallUnauthorized{} } -/*PcloudPlacementgroupsGetallUnauthorized handles this case with default header values. +/* PcloudPlacementgroupsGetallUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -132,6 +132,9 @@ type PcloudPlacementgroupsGetallUnauthorized struct { func (o *PcloudPlacementgroupsGetallUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups][%d] pcloudPlacementgroupsGetallUnauthorized %+v", 401, o.Payload) } +func (o *PcloudPlacementgroupsGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPlacementgroupsGetallUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -150,7 +153,7 @@ func NewPcloudPlacementgroupsGetallInternalServerError() *PcloudPlacementgroupsG return &PcloudPlacementgroupsGetallInternalServerError{} } -/*PcloudPlacementgroupsGetallInternalServerError handles this case with default header values. +/* PcloudPlacementgroupsGetallInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -161,6 +164,9 @@ type PcloudPlacementgroupsGetallInternalServerError struct { func (o *PcloudPlacementgroupsGetallInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups][%d] pcloudPlacementgroupsGetallInternalServerError %+v", 500, o.Payload) } +func (o *PcloudPlacementgroupsGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPlacementgroupsGetallInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_placement_groups/pcloud_placementgroups_members_delete_parameters.go b/power/client/p_cloud_placement_groups/pcloud_placementgroups_members_delete_parameters.go index f9422bd7..c860277a 100644 --- a/power/client/p_cloud_placement_groups/pcloud_placementgroups_members_delete_parameters.go +++ b/power/client/p_cloud_placement_groups/pcloud_placementgroups_members_delete_parameters.go @@ -13,69 +13,69 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudPlacementgroupsMembersDeleteParams creates a new PcloudPlacementgroupsMembersDeleteParams object -// with the default values initialized. +// NewPcloudPlacementgroupsMembersDeleteParams creates a new PcloudPlacementgroupsMembersDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudPlacementgroupsMembersDeleteParams() *PcloudPlacementgroupsMembersDeleteParams { - var () return &PcloudPlacementgroupsMembersDeleteParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudPlacementgroupsMembersDeleteParamsWithTimeout creates a new PcloudPlacementgroupsMembersDeleteParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudPlacementgroupsMembersDeleteParamsWithTimeout(timeout time.Duration) *PcloudPlacementgroupsMembersDeleteParams { - var () return &PcloudPlacementgroupsMembersDeleteParams{ - timeout: timeout, } } // NewPcloudPlacementgroupsMembersDeleteParamsWithContext creates a new PcloudPlacementgroupsMembersDeleteParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudPlacementgroupsMembersDeleteParamsWithContext(ctx context.Context) *PcloudPlacementgroupsMembersDeleteParams { - var () return &PcloudPlacementgroupsMembersDeleteParams{ - Context: ctx, } } // NewPcloudPlacementgroupsMembersDeleteParamsWithHTTPClient creates a new PcloudPlacementgroupsMembersDeleteParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudPlacementgroupsMembersDeleteParamsWithHTTPClient(client *http.Client) *PcloudPlacementgroupsMembersDeleteParams { - var () return &PcloudPlacementgroupsMembersDeleteParams{ HTTPClient: client, } } -/*PcloudPlacementgroupsMembersDeleteParams contains all the parameters to send to the API endpoint -for the pcloud placementgroups members delete operation typically these are written to a http.Request +/* PcloudPlacementgroupsMembersDeleteParams contains all the parameters to send to the API endpoint + for the pcloud placementgroups members delete operation. + + Typically these are written to a http.Request. */ type PcloudPlacementgroupsMembersDeleteParams struct { - /*Body - Parameters for removing a Server in a Placement Group + /* Body. + Parameters for removing a Server in a Placement Group */ Body *models.PlacementGroupServer - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*PlacementGroupID - Placement Group ID + /* PlacementGroupID. + + Placement Group ID */ PlacementGroupID string @@ -84,6 +84,21 @@ type PcloudPlacementgroupsMembersDeleteParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud placementgroups members delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPlacementgroupsMembersDeleteParams) WithDefaults() *PcloudPlacementgroupsMembersDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud placementgroups members delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPlacementgroupsMembersDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud placementgroups members delete params func (o *PcloudPlacementgroupsMembersDeleteParams) WithTimeout(timeout time.Duration) *PcloudPlacementgroupsMembersDeleteParams { o.SetTimeout(timeout) @@ -157,7 +172,6 @@ func (o *PcloudPlacementgroupsMembersDeleteParams) WriteToRequest(r runtime.Clie return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_placement_groups/pcloud_placementgroups_members_delete_responses.go b/power/client/p_cloud_placement_groups/pcloud_placementgroups_members_delete_responses.go index 8c3dde34..51317876 100644 --- a/power/client/p_cloud_placement_groups/pcloud_placementgroups_members_delete_responses.go +++ b/power/client/p_cloud_placement_groups/pcloud_placementgroups_members_delete_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudPlacementgroupsMembersDeleteReader is a Reader for the PcloudPlacementgroupsMembersDelete structure. @@ -24,44 +23,44 @@ type PcloudPlacementgroupsMembersDeleteReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudPlacementgroupsMembersDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudPlacementgroupsMembersDeleteOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudPlacementgroupsMembersDeleteBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - + case 404: + result := NewPcloudPlacementgroupsMembersDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result case 409: result := NewPcloudPlacementgroupsMembersDeleteConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudPlacementgroupsMembersDeleteUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudPlacementgroupsMembersDeleteInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +69,7 @@ func NewPcloudPlacementgroupsMembersDeleteOK() *PcloudPlacementgroupsMembersDele return &PcloudPlacementgroupsMembersDeleteOK{} } -/*PcloudPlacementgroupsMembersDeleteOK handles this case with default header values. +/* PcloudPlacementgroupsMembersDeleteOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +80,9 @@ type PcloudPlacementgroupsMembersDeleteOK struct { func (o *PcloudPlacementgroupsMembersDeleteOK) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}/members][%d] pcloudPlacementgroupsMembersDeleteOK %+v", 200, o.Payload) } +func (o *PcloudPlacementgroupsMembersDeleteOK) GetPayload() *models.PlacementGroup { + return o.Payload +} func (o *PcloudPlacementgroupsMembersDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +101,7 @@ func NewPcloudPlacementgroupsMembersDeleteBadRequest() *PcloudPlacementgroupsMem return &PcloudPlacementgroupsMembersDeleteBadRequest{} } -/*PcloudPlacementgroupsMembersDeleteBadRequest handles this case with default header values. +/* PcloudPlacementgroupsMembersDeleteBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +112,9 @@ type PcloudPlacementgroupsMembersDeleteBadRequest struct { func (o *PcloudPlacementgroupsMembersDeleteBadRequest) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}/members][%d] pcloudPlacementgroupsMembersDeleteBadRequest %+v", 400, o.Payload) } +func (o *PcloudPlacementgroupsMembersDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPlacementgroupsMembersDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -123,12 +128,44 @@ func (o *PcloudPlacementgroupsMembersDeleteBadRequest) readResponse(response run return nil } +// NewPcloudPlacementgroupsMembersDeleteNotFound creates a PcloudPlacementgroupsMembersDeleteNotFound with default headers values +func NewPcloudPlacementgroupsMembersDeleteNotFound() *PcloudPlacementgroupsMembersDeleteNotFound { + return &PcloudPlacementgroupsMembersDeleteNotFound{} +} + +/* PcloudPlacementgroupsMembersDeleteNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudPlacementgroupsMembersDeleteNotFound struct { + Payload *models.Error +} + +func (o *PcloudPlacementgroupsMembersDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}/members][%d] pcloudPlacementgroupsMembersDeleteNotFound %+v", 404, o.Payload) +} +func (o *PcloudPlacementgroupsMembersDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPlacementgroupsMembersDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + // NewPcloudPlacementgroupsMembersDeleteConflict creates a PcloudPlacementgroupsMembersDeleteConflict with default headers values func NewPcloudPlacementgroupsMembersDeleteConflict() *PcloudPlacementgroupsMembersDeleteConflict { return &PcloudPlacementgroupsMembersDeleteConflict{} } -/*PcloudPlacementgroupsMembersDeleteConflict handles this case with default header values. +/* PcloudPlacementgroupsMembersDeleteConflict describes a response with status code 409, with default header values. Conflict */ @@ -139,6 +176,9 @@ type PcloudPlacementgroupsMembersDeleteConflict struct { func (o *PcloudPlacementgroupsMembersDeleteConflict) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}/members][%d] pcloudPlacementgroupsMembersDeleteConflict %+v", 409, o.Payload) } +func (o *PcloudPlacementgroupsMembersDeleteConflict) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPlacementgroupsMembersDeleteConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +197,7 @@ func NewPcloudPlacementgroupsMembersDeleteUnprocessableEntity() *PcloudPlacement return &PcloudPlacementgroupsMembersDeleteUnprocessableEntity{} } -/*PcloudPlacementgroupsMembersDeleteUnprocessableEntity handles this case with default header values. +/* PcloudPlacementgroupsMembersDeleteUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -168,6 +208,9 @@ type PcloudPlacementgroupsMembersDeleteUnprocessableEntity struct { func (o *PcloudPlacementgroupsMembersDeleteUnprocessableEntity) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}/members][%d] pcloudPlacementgroupsMembersDeleteUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudPlacementgroupsMembersDeleteUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPlacementgroupsMembersDeleteUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +229,7 @@ func NewPcloudPlacementgroupsMembersDeleteInternalServerError() *PcloudPlacement return &PcloudPlacementgroupsMembersDeleteInternalServerError{} } -/*PcloudPlacementgroupsMembersDeleteInternalServerError handles this case with default header values. +/* PcloudPlacementgroupsMembersDeleteInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +240,9 @@ type PcloudPlacementgroupsMembersDeleteInternalServerError struct { func (o *PcloudPlacementgroupsMembersDeleteInternalServerError) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}/members][%d] pcloudPlacementgroupsMembersDeleteInternalServerError %+v", 500, o.Payload) } +func (o *PcloudPlacementgroupsMembersDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPlacementgroupsMembersDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_placement_groups/pcloud_placementgroups_members_post_parameters.go b/power/client/p_cloud_placement_groups/pcloud_placementgroups_members_post_parameters.go index 05d85b1a..8f9106c1 100644 --- a/power/client/p_cloud_placement_groups/pcloud_placementgroups_members_post_parameters.go +++ b/power/client/p_cloud_placement_groups/pcloud_placementgroups_members_post_parameters.go @@ -13,69 +13,69 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudPlacementgroupsMembersPostParams creates a new PcloudPlacementgroupsMembersPostParams object -// with the default values initialized. +// NewPcloudPlacementgroupsMembersPostParams creates a new PcloudPlacementgroupsMembersPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudPlacementgroupsMembersPostParams() *PcloudPlacementgroupsMembersPostParams { - var () return &PcloudPlacementgroupsMembersPostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudPlacementgroupsMembersPostParamsWithTimeout creates a new PcloudPlacementgroupsMembersPostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudPlacementgroupsMembersPostParamsWithTimeout(timeout time.Duration) *PcloudPlacementgroupsMembersPostParams { - var () return &PcloudPlacementgroupsMembersPostParams{ - timeout: timeout, } } // NewPcloudPlacementgroupsMembersPostParamsWithContext creates a new PcloudPlacementgroupsMembersPostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudPlacementgroupsMembersPostParamsWithContext(ctx context.Context) *PcloudPlacementgroupsMembersPostParams { - var () return &PcloudPlacementgroupsMembersPostParams{ - Context: ctx, } } // NewPcloudPlacementgroupsMembersPostParamsWithHTTPClient creates a new PcloudPlacementgroupsMembersPostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudPlacementgroupsMembersPostParamsWithHTTPClient(client *http.Client) *PcloudPlacementgroupsMembersPostParams { - var () return &PcloudPlacementgroupsMembersPostParams{ HTTPClient: client, } } -/*PcloudPlacementgroupsMembersPostParams contains all the parameters to send to the API endpoint -for the pcloud placementgroups members post operation typically these are written to a http.Request +/* PcloudPlacementgroupsMembersPostParams contains all the parameters to send to the API endpoint + for the pcloud placementgroups members post operation. + + Typically these are written to a http.Request. */ type PcloudPlacementgroupsMembersPostParams struct { - /*Body - Parameters for adding a server to a Server Placement Group + /* Body. + Parameters for adding a server to a Server Placement Group */ Body *models.PlacementGroupServer - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*PlacementGroupID - Placement Group ID + /* PlacementGroupID. + + Placement Group ID */ PlacementGroupID string @@ -84,6 +84,21 @@ type PcloudPlacementgroupsMembersPostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud placementgroups members post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPlacementgroupsMembersPostParams) WithDefaults() *PcloudPlacementgroupsMembersPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud placementgroups members post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPlacementgroupsMembersPostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud placementgroups members post params func (o *PcloudPlacementgroupsMembersPostParams) WithTimeout(timeout time.Duration) *PcloudPlacementgroupsMembersPostParams { o.SetTimeout(timeout) @@ -157,7 +172,6 @@ func (o *PcloudPlacementgroupsMembersPostParams) WriteToRequest(r runtime.Client return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_placement_groups/pcloud_placementgroups_members_post_responses.go b/power/client/p_cloud_placement_groups/pcloud_placementgroups_members_post_responses.go index fce6e411..c7d53f93 100644 --- a/power/client/p_cloud_placement_groups/pcloud_placementgroups_members_post_responses.go +++ b/power/client/p_cloud_placement_groups/pcloud_placementgroups_members_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudPlacementgroupsMembersPostReader is a Reader for the PcloudPlacementgroupsMembersPost structure. @@ -24,44 +23,44 @@ type PcloudPlacementgroupsMembersPostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudPlacementgroupsMembersPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudPlacementgroupsMembersPostOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudPlacementgroupsMembersPostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - + case 404: + result := NewPcloudPlacementgroupsMembersPostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result case 409: result := NewPcloudPlacementgroupsMembersPostConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudPlacementgroupsMembersPostUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudPlacementgroupsMembersPostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +69,7 @@ func NewPcloudPlacementgroupsMembersPostOK() *PcloudPlacementgroupsMembersPostOK return &PcloudPlacementgroupsMembersPostOK{} } -/*PcloudPlacementgroupsMembersPostOK handles this case with default header values. +/* PcloudPlacementgroupsMembersPostOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +80,9 @@ type PcloudPlacementgroupsMembersPostOK struct { func (o *PcloudPlacementgroupsMembersPostOK) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}/members][%d] pcloudPlacementgroupsMembersPostOK %+v", 200, o.Payload) } +func (o *PcloudPlacementgroupsMembersPostOK) GetPayload() *models.PlacementGroup { + return o.Payload +} func (o *PcloudPlacementgroupsMembersPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +101,7 @@ func NewPcloudPlacementgroupsMembersPostBadRequest() *PcloudPlacementgroupsMembe return &PcloudPlacementgroupsMembersPostBadRequest{} } -/*PcloudPlacementgroupsMembersPostBadRequest handles this case with default header values. +/* PcloudPlacementgroupsMembersPostBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +112,9 @@ type PcloudPlacementgroupsMembersPostBadRequest struct { func (o *PcloudPlacementgroupsMembersPostBadRequest) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}/members][%d] pcloudPlacementgroupsMembersPostBadRequest %+v", 400, o.Payload) } +func (o *PcloudPlacementgroupsMembersPostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPlacementgroupsMembersPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -123,12 +128,44 @@ func (o *PcloudPlacementgroupsMembersPostBadRequest) readResponse(response runti return nil } +// NewPcloudPlacementgroupsMembersPostNotFound creates a PcloudPlacementgroupsMembersPostNotFound with default headers values +func NewPcloudPlacementgroupsMembersPostNotFound() *PcloudPlacementgroupsMembersPostNotFound { + return &PcloudPlacementgroupsMembersPostNotFound{} +} + +/* PcloudPlacementgroupsMembersPostNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudPlacementgroupsMembersPostNotFound struct { + Payload *models.Error +} + +func (o *PcloudPlacementgroupsMembersPostNotFound) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}/members][%d] pcloudPlacementgroupsMembersPostNotFound %+v", 404, o.Payload) +} +func (o *PcloudPlacementgroupsMembersPostNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPlacementgroupsMembersPostNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + // NewPcloudPlacementgroupsMembersPostConflict creates a PcloudPlacementgroupsMembersPostConflict with default headers values func NewPcloudPlacementgroupsMembersPostConflict() *PcloudPlacementgroupsMembersPostConflict { return &PcloudPlacementgroupsMembersPostConflict{} } -/*PcloudPlacementgroupsMembersPostConflict handles this case with default header values. +/* PcloudPlacementgroupsMembersPostConflict describes a response with status code 409, with default header values. Conflict */ @@ -139,6 +176,9 @@ type PcloudPlacementgroupsMembersPostConflict struct { func (o *PcloudPlacementgroupsMembersPostConflict) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}/members][%d] pcloudPlacementgroupsMembersPostConflict %+v", 409, o.Payload) } +func (o *PcloudPlacementgroupsMembersPostConflict) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPlacementgroupsMembersPostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +197,7 @@ func NewPcloudPlacementgroupsMembersPostUnprocessableEntity() *PcloudPlacementgr return &PcloudPlacementgroupsMembersPostUnprocessableEntity{} } -/*PcloudPlacementgroupsMembersPostUnprocessableEntity handles this case with default header values. +/* PcloudPlacementgroupsMembersPostUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -168,6 +208,9 @@ type PcloudPlacementgroupsMembersPostUnprocessableEntity struct { func (o *PcloudPlacementgroupsMembersPostUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}/members][%d] pcloudPlacementgroupsMembersPostUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudPlacementgroupsMembersPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPlacementgroupsMembersPostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +229,7 @@ func NewPcloudPlacementgroupsMembersPostInternalServerError() *PcloudPlacementgr return &PcloudPlacementgroupsMembersPostInternalServerError{} } -/*PcloudPlacementgroupsMembersPostInternalServerError handles this case with default header values. +/* PcloudPlacementgroupsMembersPostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +240,9 @@ type PcloudPlacementgroupsMembersPostInternalServerError struct { func (o *PcloudPlacementgroupsMembersPostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}/members][%d] pcloudPlacementgroupsMembersPostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudPlacementgroupsMembersPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPlacementgroupsMembersPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_placement_groups/pcloud_placementgroups_post_parameters.go b/power/client/p_cloud_placement_groups/pcloud_placementgroups_post_parameters.go index edb21247..2bb2348a 100644 --- a/power/client/p_cloud_placement_groups/pcloud_placementgroups_post_parameters.go +++ b/power/client/p_cloud_placement_groups/pcloud_placementgroups_post_parameters.go @@ -13,64 +13,63 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudPlacementgroupsPostParams creates a new PcloudPlacementgroupsPostParams object -// with the default values initialized. +// NewPcloudPlacementgroupsPostParams creates a new PcloudPlacementgroupsPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudPlacementgroupsPostParams() *PcloudPlacementgroupsPostParams { - var () return &PcloudPlacementgroupsPostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudPlacementgroupsPostParamsWithTimeout creates a new PcloudPlacementgroupsPostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudPlacementgroupsPostParamsWithTimeout(timeout time.Duration) *PcloudPlacementgroupsPostParams { - var () return &PcloudPlacementgroupsPostParams{ - timeout: timeout, } } // NewPcloudPlacementgroupsPostParamsWithContext creates a new PcloudPlacementgroupsPostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudPlacementgroupsPostParamsWithContext(ctx context.Context) *PcloudPlacementgroupsPostParams { - var () return &PcloudPlacementgroupsPostParams{ - Context: ctx, } } // NewPcloudPlacementgroupsPostParamsWithHTTPClient creates a new PcloudPlacementgroupsPostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudPlacementgroupsPostParamsWithHTTPClient(client *http.Client) *PcloudPlacementgroupsPostParams { - var () return &PcloudPlacementgroupsPostParams{ HTTPClient: client, } } -/*PcloudPlacementgroupsPostParams contains all the parameters to send to the API endpoint -for the pcloud placementgroups post operation typically these are written to a http.Request +/* PcloudPlacementgroupsPostParams contains all the parameters to send to the API endpoint + for the pcloud placementgroups post operation. + + Typically these are written to a http.Request. */ type PcloudPlacementgroupsPostParams struct { - /*Body - Parameters for the creation of a new Server Placement Group + /* Body. + Parameters for the creation of a new Server Placement Group */ Body *models.PlacementGroupCreate - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -79,6 +78,21 @@ type PcloudPlacementgroupsPostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud placementgroups post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPlacementgroupsPostParams) WithDefaults() *PcloudPlacementgroupsPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud placementgroups post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPlacementgroupsPostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud placementgroups post params func (o *PcloudPlacementgroupsPostParams) WithTimeout(timeout time.Duration) *PcloudPlacementgroupsPostParams { o.SetTimeout(timeout) @@ -141,7 +155,6 @@ func (o *PcloudPlacementgroupsPostParams) WriteToRequest(r runtime.ClientRequest return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_placement_groups/pcloud_placementgroups_post_responses.go b/power/client/p_cloud_placement_groups/pcloud_placementgroups_post_responses.go index ff49f94d..448359f1 100644 --- a/power/client/p_cloud_placement_groups/pcloud_placementgroups_post_responses.go +++ b/power/client/p_cloud_placement_groups/pcloud_placementgroups_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudPlacementgroupsPostReader is a Reader for the PcloudPlacementgroupsPost structure. @@ -24,44 +23,38 @@ type PcloudPlacementgroupsPostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudPlacementgroupsPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudPlacementgroupsPostOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudPlacementgroupsPostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 409: result := NewPcloudPlacementgroupsPostConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudPlacementgroupsPostUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudPlacementgroupsPostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudPlacementgroupsPostOK() *PcloudPlacementgroupsPostOK { return &PcloudPlacementgroupsPostOK{} } -/*PcloudPlacementgroupsPostOK handles this case with default header values. +/* PcloudPlacementgroupsPostOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudPlacementgroupsPostOK struct { func (o *PcloudPlacementgroupsPostOK) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups][%d] pcloudPlacementgroupsPostOK %+v", 200, o.Payload) } +func (o *PcloudPlacementgroupsPostOK) GetPayload() *models.PlacementGroup { + return o.Payload +} func (o *PcloudPlacementgroupsPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudPlacementgroupsPostBadRequest() *PcloudPlacementgroupsPostBadReque return &PcloudPlacementgroupsPostBadRequest{} } -/*PcloudPlacementgroupsPostBadRequest handles this case with default header values. +/* PcloudPlacementgroupsPostBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudPlacementgroupsPostBadRequest struct { func (o *PcloudPlacementgroupsPostBadRequest) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups][%d] pcloudPlacementgroupsPostBadRequest %+v", 400, o.Payload) } +func (o *PcloudPlacementgroupsPostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPlacementgroupsPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudPlacementgroupsPostConflict() *PcloudPlacementgroupsPostConflict { return &PcloudPlacementgroupsPostConflict{} } -/*PcloudPlacementgroupsPostConflict handles this case with default header values. +/* PcloudPlacementgroupsPostConflict describes a response with status code 409, with default header values. Conflict */ @@ -139,6 +138,9 @@ type PcloudPlacementgroupsPostConflict struct { func (o *PcloudPlacementgroupsPostConflict) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups][%d] pcloudPlacementgroupsPostConflict %+v", 409, o.Payload) } +func (o *PcloudPlacementgroupsPostConflict) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPlacementgroupsPostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudPlacementgroupsPostUnprocessableEntity() *PcloudPlacementgroupsPos return &PcloudPlacementgroupsPostUnprocessableEntity{} } -/*PcloudPlacementgroupsPostUnprocessableEntity handles this case with default header values. +/* PcloudPlacementgroupsPostUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -168,6 +170,9 @@ type PcloudPlacementgroupsPostUnprocessableEntity struct { func (o *PcloudPlacementgroupsPostUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups][%d] pcloudPlacementgroupsPostUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudPlacementgroupsPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPlacementgroupsPostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudPlacementgroupsPostInternalServerError() *PcloudPlacementgroupsPos return &PcloudPlacementgroupsPostInternalServerError{} } -/*PcloudPlacementgroupsPostInternalServerError handles this case with default header values. +/* PcloudPlacementgroupsPostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudPlacementgroupsPostInternalServerError struct { func (o *PcloudPlacementgroupsPostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups][%d] pcloudPlacementgroupsPostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudPlacementgroupsPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPlacementgroupsPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_s_a_p/p_cloud_s_a_p_client.go b/power/client/p_cloud_s_a_p/p_cloudsap_client.go similarity index 53% rename from power/client/p_cloud_s_a_p/p_cloud_s_a_p_client.go rename to power/client/p_cloud_s_a_p/p_cloudsap_client.go index a6a75e14..0504c37c 100644 --- a/power/client/p_cloud_s_a_p/p_cloud_s_a_p_client.go +++ b/power/client/p_cloud_s_a_p/p_cloudsap_client.go @@ -6,13 +6,14 @@ package p_cloud_s_a_p // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/runtime" + "fmt" - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" ) // New creates a new p cloud s a p API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { return &Client{transport: transport, formats: formats} } @@ -24,16 +25,29 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudSapGet(params *PcloudSapGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudSapGetOK, error) + + PcloudSapGetall(params *PcloudSapGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudSapGetallOK, error) + + PcloudSapPost(params *PcloudSapPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudSapPostOK, *PcloudSapPostCreated, *PcloudSapPostAccepted, error) + + SetTransport(transport runtime.ClientTransport) +} + /* -PcloudSapGet gets the information on an s a p profile + PcloudSapGet gets the information on an s a p profile */ -func (a *Client) PcloudSapGet(params *PcloudSapGetParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudSapGetOK, error) { +func (a *Client) PcloudSapGet(params *PcloudSapGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudSapGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudSapGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.sap.get", Method: "GET", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/sap/{sap_profile_id}", @@ -45,24 +59,34 @@ func (a *Client) PcloudSapGet(params *PcloudSapGetParams, authInfo runtime.Clien AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudSapGetOK), nil - + success, ok := result.(*PcloudSapGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.sap.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudSapGetall gets list of s a p profiles + PcloudSapGetall gets list of s a p profiles */ -func (a *Client) PcloudSapGetall(params *PcloudSapGetallParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudSapGetallOK, error) { +func (a *Client) PcloudSapGetall(params *PcloudSapGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudSapGetallOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudSapGetallParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.sap.getall", Method: "GET", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/sap", @@ -74,24 +98,34 @@ func (a *Client) PcloudSapGetall(params *PcloudSapGetallParams, authInfo runtime AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudSapGetallOK), nil - + success, ok := result.(*PcloudSapGetallOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.sap.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudSapPost creates a new s a p p VM instance + PcloudSapPost creates a new s a p p VM instance */ -func (a *Client) PcloudSapPost(params *PcloudSapPostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudSapPostOK, *PcloudSapPostCreated, *PcloudSapPostAccepted, error) { +func (a *Client) PcloudSapPost(params *PcloudSapPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudSapPostOK, *PcloudSapPostCreated, *PcloudSapPostAccepted, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudSapPostParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.sap.post", Method: "POST", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/sap", @@ -103,7 +137,12 @@ func (a *Client) PcloudSapPost(params *PcloudSapPostParams, authInfo runtime.Cli AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, nil, nil, err } @@ -115,8 +154,9 @@ func (a *Client) PcloudSapPost(params *PcloudSapPostParams, authInfo runtime.Cli case *PcloudSapPostAccepted: return nil, nil, value, nil } - return nil, nil, nil, nil - + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for p_cloud_s_a_p: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } // SetTransport changes the transport on the client diff --git a/power/client/p_cloud_s_a_p/pcloud_sap_get_parameters.go b/power/client/p_cloud_s_a_p/pcloud_sap_get_parameters.go index 72ed1f22..76081ddb 100644 --- a/power/client/p_cloud_s_a_p/pcloud_sap_get_parameters.go +++ b/power/client/p_cloud_s_a_p/pcloud_sap_get_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudSapGetParams creates a new PcloudSapGetParams object -// with the default values initialized. +// NewPcloudSapGetParams creates a new PcloudSapGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudSapGetParams() *PcloudSapGetParams { - var () return &PcloudSapGetParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudSapGetParamsWithTimeout creates a new PcloudSapGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudSapGetParamsWithTimeout(timeout time.Duration) *PcloudSapGetParams { - var () return &PcloudSapGetParams{ - timeout: timeout, } } // NewPcloudSapGetParamsWithContext creates a new PcloudSapGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudSapGetParamsWithContext(ctx context.Context) *PcloudSapGetParams { - var () return &PcloudSapGetParams{ - Context: ctx, } } // NewPcloudSapGetParamsWithHTTPClient creates a new PcloudSapGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudSapGetParamsWithHTTPClient(client *http.Client) *PcloudSapGetParams { - var () return &PcloudSapGetParams{ HTTPClient: client, } } -/*PcloudSapGetParams contains all the parameters to send to the API endpoint -for the pcloud sap get operation typically these are written to a http.Request +/* PcloudSapGetParams contains all the parameters to send to the API endpoint + for the pcloud sap get operation. + + Typically these are written to a http.Request. */ type PcloudSapGetParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*SapProfileID - SAP Profile ID + /* SapProfileID. + + SAP Profile ID */ SapProfileID string @@ -77,6 +76,21 @@ type PcloudSapGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud sap get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudSapGetParams) WithDefaults() *PcloudSapGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud sap get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudSapGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud sap get params func (o *PcloudSapGetParams) WithTimeout(timeout time.Duration) *PcloudSapGetParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_s_a_p/pcloud_sap_get_responses.go b/power/client/p_cloud_s_a_p/pcloud_sap_get_responses.go index b8215456..395448fd 100644 --- a/power/client/p_cloud_s_a_p/pcloud_sap_get_responses.go +++ b/power/client/p_cloud_s_a_p/pcloud_sap_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudSapGetReader is a Reader for the PcloudSapGet structure. @@ -24,44 +23,38 @@ type PcloudSapGetReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudSapGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudSapGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudSapGetBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudSapGetUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudSapGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudSapGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudSapGetOK() *PcloudSapGetOK { return &PcloudSapGetOK{} } -/*PcloudSapGetOK handles this case with default header values. +/* PcloudSapGetOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudSapGetOK struct { func (o *PcloudSapGetOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/sap/{sap_profile_id}][%d] pcloudSapGetOK %+v", 200, o.Payload) } +func (o *PcloudSapGetOK) GetPayload() *models.SAPProfile { + return o.Payload +} func (o *PcloudSapGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudSapGetBadRequest() *PcloudSapGetBadRequest { return &PcloudSapGetBadRequest{} } -/*PcloudSapGetBadRequest handles this case with default header values. +/* PcloudSapGetBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudSapGetBadRequest struct { func (o *PcloudSapGetBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/sap/{sap_profile_id}][%d] pcloudSapGetBadRequest %+v", 400, o.Payload) } +func (o *PcloudSapGetBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudSapGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudSapGetUnauthorized() *PcloudSapGetUnauthorized { return &PcloudSapGetUnauthorized{} } -/*PcloudSapGetUnauthorized handles this case with default header values. +/* PcloudSapGetUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudSapGetUnauthorized struct { func (o *PcloudSapGetUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/sap/{sap_profile_id}][%d] pcloudSapGetUnauthorized %+v", 401, o.Payload) } +func (o *PcloudSapGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudSapGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudSapGetNotFound() *PcloudSapGetNotFound { return &PcloudSapGetNotFound{} } -/*PcloudSapGetNotFound handles this case with default header values. +/* PcloudSapGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -168,6 +170,9 @@ type PcloudSapGetNotFound struct { func (o *PcloudSapGetNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/sap/{sap_profile_id}][%d] pcloudSapGetNotFound %+v", 404, o.Payload) } +func (o *PcloudSapGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudSapGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudSapGetInternalServerError() *PcloudSapGetInternalServerError { return &PcloudSapGetInternalServerError{} } -/*PcloudSapGetInternalServerError handles this case with default header values. +/* PcloudSapGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudSapGetInternalServerError struct { func (o *PcloudSapGetInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/sap/{sap_profile_id}][%d] pcloudSapGetInternalServerError %+v", 500, o.Payload) } +func (o *PcloudSapGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudSapGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_s_a_p/pcloud_sap_getall_parameters.go b/power/client/p_cloud_s_a_p/pcloud_sap_getall_parameters.go index f68f39dd..725a1afc 100644 --- a/power/client/p_cloud_s_a_p/pcloud_sap_getall_parameters.go +++ b/power/client/p_cloud_s_a_p/pcloud_sap_getall_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudSapGetallParams creates a new PcloudSapGetallParams object -// with the default values initialized. +// NewPcloudSapGetallParams creates a new PcloudSapGetallParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudSapGetallParams() *PcloudSapGetallParams { - var () return &PcloudSapGetallParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudSapGetallParamsWithTimeout creates a new PcloudSapGetallParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudSapGetallParamsWithTimeout(timeout time.Duration) *PcloudSapGetallParams { - var () return &PcloudSapGetallParams{ - timeout: timeout, } } // NewPcloudSapGetallParamsWithContext creates a new PcloudSapGetallParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudSapGetallParamsWithContext(ctx context.Context) *PcloudSapGetallParams { - var () return &PcloudSapGetallParams{ - Context: ctx, } } // NewPcloudSapGetallParamsWithHTTPClient creates a new PcloudSapGetallParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudSapGetallParamsWithHTTPClient(client *http.Client) *PcloudSapGetallParams { - var () return &PcloudSapGetallParams{ HTTPClient: client, } } -/*PcloudSapGetallParams contains all the parameters to send to the API endpoint -for the pcloud sap getall operation typically these are written to a http.Request +/* PcloudSapGetallParams contains all the parameters to send to the API endpoint + for the pcloud sap getall operation. + + Typically these are written to a http.Request. */ type PcloudSapGetallParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -72,6 +70,21 @@ type PcloudSapGetallParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud sap getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudSapGetallParams) WithDefaults() *PcloudSapGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud sap getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudSapGetallParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud sap getall params func (o *PcloudSapGetallParams) WithTimeout(timeout time.Duration) *PcloudSapGetallParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_s_a_p/pcloud_sap_getall_responses.go b/power/client/p_cloud_s_a_p/pcloud_sap_getall_responses.go index f2c277b3..97b35e04 100644 --- a/power/client/p_cloud_s_a_p/pcloud_sap_getall_responses.go +++ b/power/client/p_cloud_s_a_p/pcloud_sap_getall_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudSapGetallReader is a Reader for the PcloudSapGetall structure. @@ -24,37 +23,32 @@ type PcloudSapGetallReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudSapGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudSapGetallOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudSapGetallBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudSapGetallUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudSapGetallInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -63,7 +57,7 @@ func NewPcloudSapGetallOK() *PcloudSapGetallOK { return &PcloudSapGetallOK{} } -/*PcloudSapGetallOK handles this case with default header values. +/* PcloudSapGetallOK describes a response with status code 200, with default header values. OK */ @@ -74,6 +68,9 @@ type PcloudSapGetallOK struct { func (o *PcloudSapGetallOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/sap][%d] pcloudSapGetallOK %+v", 200, o.Payload) } +func (o *PcloudSapGetallOK) GetPayload() *models.SAPProfiles { + return o.Payload +} func (o *PcloudSapGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -92,7 +89,7 @@ func NewPcloudSapGetallBadRequest() *PcloudSapGetallBadRequest { return &PcloudSapGetallBadRequest{} } -/*PcloudSapGetallBadRequest handles this case with default header values. +/* PcloudSapGetallBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -103,6 +100,9 @@ type PcloudSapGetallBadRequest struct { func (o *PcloudSapGetallBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/sap][%d] pcloudSapGetallBadRequest %+v", 400, o.Payload) } +func (o *PcloudSapGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudSapGetallBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -121,7 +121,7 @@ func NewPcloudSapGetallUnauthorized() *PcloudSapGetallUnauthorized { return &PcloudSapGetallUnauthorized{} } -/*PcloudSapGetallUnauthorized handles this case with default header values. +/* PcloudSapGetallUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -132,6 +132,9 @@ type PcloudSapGetallUnauthorized struct { func (o *PcloudSapGetallUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/sap][%d] pcloudSapGetallUnauthorized %+v", 401, o.Payload) } +func (o *PcloudSapGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudSapGetallUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -150,7 +153,7 @@ func NewPcloudSapGetallInternalServerError() *PcloudSapGetallInternalServerError return &PcloudSapGetallInternalServerError{} } -/*PcloudSapGetallInternalServerError handles this case with default header values. +/* PcloudSapGetallInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -161,6 +164,9 @@ type PcloudSapGetallInternalServerError struct { func (o *PcloudSapGetallInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/sap][%d] pcloudSapGetallInternalServerError %+v", 500, o.Payload) } +func (o *PcloudSapGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudSapGetallInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_s_a_p/pcloud_sap_post_parameters.go b/power/client/p_cloud_s_a_p/pcloud_sap_post_parameters.go index 91eea914..1b8ad094 100644 --- a/power/client/p_cloud_s_a_p/pcloud_sap_post_parameters.go +++ b/power/client/p_cloud_s_a_p/pcloud_sap_post_parameters.go @@ -13,64 +13,63 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudSapPostParams creates a new PcloudSapPostParams object -// with the default values initialized. +// NewPcloudSapPostParams creates a new PcloudSapPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudSapPostParams() *PcloudSapPostParams { - var () return &PcloudSapPostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudSapPostParamsWithTimeout creates a new PcloudSapPostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudSapPostParamsWithTimeout(timeout time.Duration) *PcloudSapPostParams { - var () return &PcloudSapPostParams{ - timeout: timeout, } } // NewPcloudSapPostParamsWithContext creates a new PcloudSapPostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudSapPostParamsWithContext(ctx context.Context) *PcloudSapPostParams { - var () return &PcloudSapPostParams{ - Context: ctx, } } // NewPcloudSapPostParamsWithHTTPClient creates a new PcloudSapPostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudSapPostParamsWithHTTPClient(client *http.Client) *PcloudSapPostParams { - var () return &PcloudSapPostParams{ HTTPClient: client, } } -/*PcloudSapPostParams contains all the parameters to send to the API endpoint -for the pcloud sap post operation typically these are written to a http.Request +/* PcloudSapPostParams contains all the parameters to send to the API endpoint + for the pcloud sap post operation. + + Typically these are written to a http.Request. */ type PcloudSapPostParams struct { - /*Body - Parameters for the creation of a new SAP PVM Instance + /* Body. + Parameters for the creation of a new SAP PVM Instance */ Body *models.SAPCreate - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -79,6 +78,21 @@ type PcloudSapPostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud sap post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudSapPostParams) WithDefaults() *PcloudSapPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud sap post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudSapPostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud sap post params func (o *PcloudSapPostParams) WithTimeout(timeout time.Duration) *PcloudSapPostParams { o.SetTimeout(timeout) @@ -141,7 +155,6 @@ func (o *PcloudSapPostParams) WriteToRequest(r runtime.ClientRequest, reg strfmt return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_s_a_p/pcloud_sap_post_responses.go b/power/client/p_cloud_s_a_p/pcloud_sap_post_responses.go index 559beea2..802291ee 100644 --- a/power/client/p_cloud_s_a_p/pcloud_sap_post_responses.go +++ b/power/client/p_cloud_s_a_p/pcloud_sap_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudSapPostReader is a Reader for the PcloudSapPost structure. @@ -24,65 +23,56 @@ type PcloudSapPostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudSapPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudSapPostOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 201: result := NewPcloudSapPostCreated() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 202: result := NewPcloudSapPostAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudSapPostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudSapPostUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 409: result := NewPcloudSapPostConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudSapPostUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudSapPostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -91,7 +81,7 @@ func NewPcloudSapPostOK() *PcloudSapPostOK { return &PcloudSapPostOK{} } -/*PcloudSapPostOK handles this case with default header values. +/* PcloudSapPostOK describes a response with status code 200, with default header values. OK */ @@ -102,6 +92,9 @@ type PcloudSapPostOK struct { func (o *PcloudSapPostOK) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/sap][%d] pcloudSapPostOK %+v", 200, o.Payload) } +func (o *PcloudSapPostOK) GetPayload() models.PVMInstanceList { + return o.Payload +} func (o *PcloudSapPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -118,7 +111,7 @@ func NewPcloudSapPostCreated() *PcloudSapPostCreated { return &PcloudSapPostCreated{} } -/*PcloudSapPostCreated handles this case with default header values. +/* PcloudSapPostCreated describes a response with status code 201, with default header values. Created */ @@ -129,6 +122,9 @@ type PcloudSapPostCreated struct { func (o *PcloudSapPostCreated) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/sap][%d] pcloudSapPostCreated %+v", 201, o.Payload) } +func (o *PcloudSapPostCreated) GetPayload() models.PVMInstanceList { + return o.Payload +} func (o *PcloudSapPostCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -145,7 +141,7 @@ func NewPcloudSapPostAccepted() *PcloudSapPostAccepted { return &PcloudSapPostAccepted{} } -/*PcloudSapPostAccepted handles this case with default header values. +/* PcloudSapPostAccepted describes a response with status code 202, with default header values. Accepted */ @@ -156,6 +152,9 @@ type PcloudSapPostAccepted struct { func (o *PcloudSapPostAccepted) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/sap][%d] pcloudSapPostAccepted %+v", 202, o.Payload) } +func (o *PcloudSapPostAccepted) GetPayload() models.PVMInstanceList { + return o.Payload +} func (o *PcloudSapPostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -172,7 +171,7 @@ func NewPcloudSapPostBadRequest() *PcloudSapPostBadRequest { return &PcloudSapPostBadRequest{} } -/*PcloudSapPostBadRequest handles this case with default header values. +/* PcloudSapPostBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -183,6 +182,9 @@ type PcloudSapPostBadRequest struct { func (o *PcloudSapPostBadRequest) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/sap][%d] pcloudSapPostBadRequest %+v", 400, o.Payload) } +func (o *PcloudSapPostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudSapPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -201,7 +203,7 @@ func NewPcloudSapPostUnauthorized() *PcloudSapPostUnauthorized { return &PcloudSapPostUnauthorized{} } -/*PcloudSapPostUnauthorized handles this case with default header values. +/* PcloudSapPostUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -212,6 +214,9 @@ type PcloudSapPostUnauthorized struct { func (o *PcloudSapPostUnauthorized) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/sap][%d] pcloudSapPostUnauthorized %+v", 401, o.Payload) } +func (o *PcloudSapPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudSapPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -230,7 +235,7 @@ func NewPcloudSapPostConflict() *PcloudSapPostConflict { return &PcloudSapPostConflict{} } -/*PcloudSapPostConflict handles this case with default header values. +/* PcloudSapPostConflict describes a response with status code 409, with default header values. Conflict */ @@ -241,6 +246,9 @@ type PcloudSapPostConflict struct { func (o *PcloudSapPostConflict) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/sap][%d] pcloudSapPostConflict %+v", 409, o.Payload) } +func (o *PcloudSapPostConflict) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudSapPostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -259,7 +267,7 @@ func NewPcloudSapPostUnprocessableEntity() *PcloudSapPostUnprocessableEntity { return &PcloudSapPostUnprocessableEntity{} } -/*PcloudSapPostUnprocessableEntity handles this case with default header values. +/* PcloudSapPostUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -270,6 +278,9 @@ type PcloudSapPostUnprocessableEntity struct { func (o *PcloudSapPostUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/sap][%d] pcloudSapPostUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudSapPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudSapPostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -288,7 +299,7 @@ func NewPcloudSapPostInternalServerError() *PcloudSapPostInternalServerError { return &PcloudSapPostInternalServerError{} } -/*PcloudSapPostInternalServerError handles this case with default header values. +/* PcloudSapPostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -299,6 +310,9 @@ type PcloudSapPostInternalServerError struct { func (o *PcloudSapPostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/sap][%d] pcloudSapPostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudSapPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudSapPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_service_d_h_c_p/p_cloud_service_d_h_c_p_client.go b/power/client/p_cloud_service_d_h_c_p/p_cloud_service_d_h_c_p_client.go deleted file mode 100644 index 6d94f0f8..00000000 --- a/power/client/p_cloud_service_d_h_c_p/p_cloud_service_d_h_c_p_client.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package p_cloud_service_d_h_c_p - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "github.com/go-openapi/runtime" - - strfmt "github.com/go-openapi/strfmt" -) - -// New creates a new p cloud service d h c p API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { - return &Client{transport: transport, formats: formats} -} - -/* -Client for p cloud service d h c p API -*/ -type Client struct { - transport runtime.ClientTransport - formats strfmt.Registry -} - -/* -PcloudDhcpDelete deletes d h c p server open shift internal use only -*/ -func (a *Client) PcloudDhcpDelete(params *PcloudDhcpDeleteParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudDhcpDeleteAccepted, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudDhcpDeleteParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.dhcp.delete", - Method: "DELETE", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp/{dhcp_id}", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudDhcpDeleteReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudDhcpDeleteAccepted), nil - -} - -/* -PcloudDhcpGet gets d h c p server information open shift internal use only -*/ -func (a *Client) PcloudDhcpGet(params *PcloudDhcpGetParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudDhcpGetOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudDhcpGetParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.dhcp.get", - Method: "GET", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp/{dhcp_id}", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudDhcpGetReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudDhcpGetOK), nil - -} - -/* -PcloudDhcpGetall gets all d h c p servers information open shift internal use only -*/ -func (a *Client) PcloudDhcpGetall(params *PcloudDhcpGetallParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudDhcpGetallOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudDhcpGetallParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.dhcp.getall", - Method: "GET", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudDhcpGetallReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudDhcpGetallOK), nil - -} - -/* -PcloudDhcpPost creates a d h c p server open shift internal use only -*/ -func (a *Client) PcloudDhcpPost(params *PcloudDhcpPostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudDhcpPostAccepted, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudDhcpPostParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.dhcp.post", - Method: "POST", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudDhcpPostReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudDhcpPostAccepted), nil - -} - -// SetTransport changes the transport on the client -func (a *Client) SetTransport(transport runtime.ClientTransport) { - a.transport = transport -} diff --git a/power/client/p_cloud_service_d_h_c_p/p_cloud_servicedhcp_client.go b/power/client/p_cloud_service_d_h_c_p/p_cloud_servicedhcp_client.go new file mode 100644 index 00000000..ddf143b6 --- /dev/null +++ b/power/client/p_cloud_service_d_h_c_p/p_cloud_servicedhcp_client.go @@ -0,0 +1,203 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_service_d_h_c_p + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// New creates a new p cloud service d h c p API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for p cloud service d h c p API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudDhcpDelete(params *PcloudDhcpDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudDhcpDeleteAccepted, error) + + PcloudDhcpGet(params *PcloudDhcpGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudDhcpGetOK, error) + + PcloudDhcpGetall(params *PcloudDhcpGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudDhcpGetallOK, error) + + PcloudDhcpPost(params *PcloudDhcpPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudDhcpPostAccepted, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + PcloudDhcpDelete deletes d h c p server open shift internal use only +*/ +func (a *Client) PcloudDhcpDelete(params *PcloudDhcpDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudDhcpDeleteAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudDhcpDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.dhcp.delete", + Method: "DELETE", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp/{dhcp_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudDhcpDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudDhcpDeleteAccepted) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.dhcp.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudDhcpGet gets d h c p server information open shift internal use only +*/ +func (a *Client) PcloudDhcpGet(params *PcloudDhcpGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudDhcpGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudDhcpGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.dhcp.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp/{dhcp_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudDhcpGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudDhcpGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.dhcp.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudDhcpGetall gets all d h c p servers information open shift internal use only +*/ +func (a *Client) PcloudDhcpGetall(params *PcloudDhcpGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudDhcpGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudDhcpGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.dhcp.getall", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudDhcpGetallReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudDhcpGetallOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.dhcp.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudDhcpPost creates a d h c p server open shift internal use only +*/ +func (a *Client) PcloudDhcpPost(params *PcloudDhcpPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudDhcpPostAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudDhcpPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.dhcp.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudDhcpPostReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudDhcpPostAccepted) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.dhcp.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_delete_parameters.go b/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_delete_parameters.go index cfd3fc61..3869c756 100644 --- a/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_delete_parameters.go +++ b/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_delete_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudDhcpDeleteParams creates a new PcloudDhcpDeleteParams object -// with the default values initialized. +// NewPcloudDhcpDeleteParams creates a new PcloudDhcpDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudDhcpDeleteParams() *PcloudDhcpDeleteParams { - var () return &PcloudDhcpDeleteParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudDhcpDeleteParamsWithTimeout creates a new PcloudDhcpDeleteParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudDhcpDeleteParamsWithTimeout(timeout time.Duration) *PcloudDhcpDeleteParams { - var () return &PcloudDhcpDeleteParams{ - timeout: timeout, } } // NewPcloudDhcpDeleteParamsWithContext creates a new PcloudDhcpDeleteParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudDhcpDeleteParamsWithContext(ctx context.Context) *PcloudDhcpDeleteParams { - var () return &PcloudDhcpDeleteParams{ - Context: ctx, } } // NewPcloudDhcpDeleteParamsWithHTTPClient creates a new PcloudDhcpDeleteParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudDhcpDeleteParamsWithHTTPClient(client *http.Client) *PcloudDhcpDeleteParams { - var () return &PcloudDhcpDeleteParams{ HTTPClient: client, } } -/*PcloudDhcpDeleteParams contains all the parameters to send to the API endpoint -for the pcloud dhcp delete operation typically these are written to a http.Request +/* PcloudDhcpDeleteParams contains all the parameters to send to the API endpoint + for the pcloud dhcp delete operation. + + Typically these are written to a http.Request. */ type PcloudDhcpDeleteParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*DhcpID - The ID of the DHCP Server + /* DhcpID. + + The ID of the DHCP Server */ DhcpID string @@ -77,6 +76,21 @@ type PcloudDhcpDeleteParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud dhcp delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudDhcpDeleteParams) WithDefaults() *PcloudDhcpDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud dhcp delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudDhcpDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud dhcp delete params func (o *PcloudDhcpDeleteParams) WithTimeout(timeout time.Duration) *PcloudDhcpDeleteParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_delete_responses.go b/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_delete_responses.go index b49dd1dd..f108dada 100644 --- a/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_delete_responses.go +++ b/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_delete_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudDhcpDeleteReader is a Reader for the PcloudDhcpDelete structure. @@ -24,44 +23,38 @@ type PcloudDhcpDeleteReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudDhcpDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 202: result := NewPcloudDhcpDeleteAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudDhcpDeleteBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 403: result := NewPcloudDhcpDeleteForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudDhcpDeleteNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudDhcpDeleteInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudDhcpDeleteAccepted() *PcloudDhcpDeleteAccepted { return &PcloudDhcpDeleteAccepted{} } -/*PcloudDhcpDeleteAccepted handles this case with default header values. +/* PcloudDhcpDeleteAccepted describes a response with status code 202, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudDhcpDeleteAccepted struct { func (o *PcloudDhcpDeleteAccepted) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp/{dhcp_id}][%d] pcloudDhcpDeleteAccepted %+v", 202, o.Payload) } +func (o *PcloudDhcpDeleteAccepted) GetPayload() models.Object { + return o.Payload +} func (o *PcloudDhcpDeleteAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -97,7 +93,7 @@ func NewPcloudDhcpDeleteBadRequest() *PcloudDhcpDeleteBadRequest { return &PcloudDhcpDeleteBadRequest{} } -/*PcloudDhcpDeleteBadRequest handles this case with default header values. +/* PcloudDhcpDeleteBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -108,6 +104,9 @@ type PcloudDhcpDeleteBadRequest struct { func (o *PcloudDhcpDeleteBadRequest) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp/{dhcp_id}][%d] pcloudDhcpDeleteBadRequest %+v", 400, o.Payload) } +func (o *PcloudDhcpDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudDhcpDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -126,7 +125,7 @@ func NewPcloudDhcpDeleteForbidden() *PcloudDhcpDeleteForbidden { return &PcloudDhcpDeleteForbidden{} } -/*PcloudDhcpDeleteForbidden handles this case with default header values. +/* PcloudDhcpDeleteForbidden describes a response with status code 403, with default header values. Forbidden */ @@ -137,6 +136,9 @@ type PcloudDhcpDeleteForbidden struct { func (o *PcloudDhcpDeleteForbidden) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp/{dhcp_id}][%d] pcloudDhcpDeleteForbidden %+v", 403, o.Payload) } +func (o *PcloudDhcpDeleteForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudDhcpDeleteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -155,7 +157,7 @@ func NewPcloudDhcpDeleteNotFound() *PcloudDhcpDeleteNotFound { return &PcloudDhcpDeleteNotFound{} } -/*PcloudDhcpDeleteNotFound handles this case with default header values. +/* PcloudDhcpDeleteNotFound describes a response with status code 404, with default header values. Not Found */ @@ -166,6 +168,9 @@ type PcloudDhcpDeleteNotFound struct { func (o *PcloudDhcpDeleteNotFound) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp/{dhcp_id}][%d] pcloudDhcpDeleteNotFound %+v", 404, o.Payload) } +func (o *PcloudDhcpDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudDhcpDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -184,7 +189,7 @@ func NewPcloudDhcpDeleteInternalServerError() *PcloudDhcpDeleteInternalServerErr return &PcloudDhcpDeleteInternalServerError{} } -/*PcloudDhcpDeleteInternalServerError handles this case with default header values. +/* PcloudDhcpDeleteInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -195,6 +200,9 @@ type PcloudDhcpDeleteInternalServerError struct { func (o *PcloudDhcpDeleteInternalServerError) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp/{dhcp_id}][%d] pcloudDhcpDeleteInternalServerError %+v", 500, o.Payload) } +func (o *PcloudDhcpDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudDhcpDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_get_parameters.go b/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_get_parameters.go index 013e92fa..341c63d4 100644 --- a/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_get_parameters.go +++ b/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_get_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudDhcpGetParams creates a new PcloudDhcpGetParams object -// with the default values initialized. +// NewPcloudDhcpGetParams creates a new PcloudDhcpGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudDhcpGetParams() *PcloudDhcpGetParams { - var () return &PcloudDhcpGetParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudDhcpGetParamsWithTimeout creates a new PcloudDhcpGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudDhcpGetParamsWithTimeout(timeout time.Duration) *PcloudDhcpGetParams { - var () return &PcloudDhcpGetParams{ - timeout: timeout, } } // NewPcloudDhcpGetParamsWithContext creates a new PcloudDhcpGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudDhcpGetParamsWithContext(ctx context.Context) *PcloudDhcpGetParams { - var () return &PcloudDhcpGetParams{ - Context: ctx, } } // NewPcloudDhcpGetParamsWithHTTPClient creates a new PcloudDhcpGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudDhcpGetParamsWithHTTPClient(client *http.Client) *PcloudDhcpGetParams { - var () return &PcloudDhcpGetParams{ HTTPClient: client, } } -/*PcloudDhcpGetParams contains all the parameters to send to the API endpoint -for the pcloud dhcp get operation typically these are written to a http.Request +/* PcloudDhcpGetParams contains all the parameters to send to the API endpoint + for the pcloud dhcp get operation. + + Typically these are written to a http.Request. */ type PcloudDhcpGetParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*DhcpID - The ID of the DHCP Server + /* DhcpID. + + The ID of the DHCP Server */ DhcpID string @@ -77,6 +76,21 @@ type PcloudDhcpGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud dhcp get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudDhcpGetParams) WithDefaults() *PcloudDhcpGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud dhcp get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudDhcpGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud dhcp get params func (o *PcloudDhcpGetParams) WithTimeout(timeout time.Duration) *PcloudDhcpGetParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_get_responses.go b/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_get_responses.go index 583f15fc..533dd79a 100644 --- a/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_get_responses.go +++ b/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudDhcpGetReader is a Reader for the PcloudDhcpGet structure. @@ -24,44 +23,38 @@ type PcloudDhcpGetReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudDhcpGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudDhcpGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudDhcpGetBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 403: result := NewPcloudDhcpGetForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudDhcpGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudDhcpGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudDhcpGetOK() *PcloudDhcpGetOK { return &PcloudDhcpGetOK{} } -/*PcloudDhcpGetOK handles this case with default header values. +/* PcloudDhcpGetOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudDhcpGetOK struct { func (o *PcloudDhcpGetOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp/{dhcp_id}][%d] pcloudDhcpGetOK %+v", 200, o.Payload) } +func (o *PcloudDhcpGetOK) GetPayload() *models.DHCPServerDetail { + return o.Payload +} func (o *PcloudDhcpGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudDhcpGetBadRequest() *PcloudDhcpGetBadRequest { return &PcloudDhcpGetBadRequest{} } -/*PcloudDhcpGetBadRequest handles this case with default header values. +/* PcloudDhcpGetBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudDhcpGetBadRequest struct { func (o *PcloudDhcpGetBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp/{dhcp_id}][%d] pcloudDhcpGetBadRequest %+v", 400, o.Payload) } +func (o *PcloudDhcpGetBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudDhcpGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudDhcpGetForbidden() *PcloudDhcpGetForbidden { return &PcloudDhcpGetForbidden{} } -/*PcloudDhcpGetForbidden handles this case with default header values. +/* PcloudDhcpGetForbidden describes a response with status code 403, with default header values. Forbidden */ @@ -139,6 +138,9 @@ type PcloudDhcpGetForbidden struct { func (o *PcloudDhcpGetForbidden) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp/{dhcp_id}][%d] pcloudDhcpGetForbidden %+v", 403, o.Payload) } +func (o *PcloudDhcpGetForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudDhcpGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudDhcpGetNotFound() *PcloudDhcpGetNotFound { return &PcloudDhcpGetNotFound{} } -/*PcloudDhcpGetNotFound handles this case with default header values. +/* PcloudDhcpGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -168,6 +170,9 @@ type PcloudDhcpGetNotFound struct { func (o *PcloudDhcpGetNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp/{dhcp_id}][%d] pcloudDhcpGetNotFound %+v", 404, o.Payload) } +func (o *PcloudDhcpGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudDhcpGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudDhcpGetInternalServerError() *PcloudDhcpGetInternalServerError { return &PcloudDhcpGetInternalServerError{} } -/*PcloudDhcpGetInternalServerError handles this case with default header values. +/* PcloudDhcpGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudDhcpGetInternalServerError struct { func (o *PcloudDhcpGetInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp/{dhcp_id}][%d] pcloudDhcpGetInternalServerError %+v", 500, o.Payload) } +func (o *PcloudDhcpGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudDhcpGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_getall_parameters.go b/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_getall_parameters.go index ac997882..52bbb848 100644 --- a/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_getall_parameters.go +++ b/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_getall_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudDhcpGetallParams creates a new PcloudDhcpGetallParams object -// with the default values initialized. +// NewPcloudDhcpGetallParams creates a new PcloudDhcpGetallParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudDhcpGetallParams() *PcloudDhcpGetallParams { - var () return &PcloudDhcpGetallParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudDhcpGetallParamsWithTimeout creates a new PcloudDhcpGetallParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudDhcpGetallParamsWithTimeout(timeout time.Duration) *PcloudDhcpGetallParams { - var () return &PcloudDhcpGetallParams{ - timeout: timeout, } } // NewPcloudDhcpGetallParamsWithContext creates a new PcloudDhcpGetallParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudDhcpGetallParamsWithContext(ctx context.Context) *PcloudDhcpGetallParams { - var () return &PcloudDhcpGetallParams{ - Context: ctx, } } // NewPcloudDhcpGetallParamsWithHTTPClient creates a new PcloudDhcpGetallParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudDhcpGetallParamsWithHTTPClient(client *http.Client) *PcloudDhcpGetallParams { - var () return &PcloudDhcpGetallParams{ HTTPClient: client, } } -/*PcloudDhcpGetallParams contains all the parameters to send to the API endpoint -for the pcloud dhcp getall operation typically these are written to a http.Request +/* PcloudDhcpGetallParams contains all the parameters to send to the API endpoint + for the pcloud dhcp getall operation. + + Typically these are written to a http.Request. */ type PcloudDhcpGetallParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -72,6 +70,21 @@ type PcloudDhcpGetallParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud dhcp getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudDhcpGetallParams) WithDefaults() *PcloudDhcpGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud dhcp getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudDhcpGetallParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud dhcp getall params func (o *PcloudDhcpGetallParams) WithTimeout(timeout time.Duration) *PcloudDhcpGetallParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_getall_responses.go b/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_getall_responses.go index aae299c2..3aeb4415 100644 --- a/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_getall_responses.go +++ b/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_getall_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudDhcpGetallReader is a Reader for the PcloudDhcpGetall structure. @@ -24,30 +23,26 @@ type PcloudDhcpGetallReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudDhcpGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudDhcpGetallOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 403: result := NewPcloudDhcpGetallForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudDhcpGetallInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -56,7 +51,7 @@ func NewPcloudDhcpGetallOK() *PcloudDhcpGetallOK { return &PcloudDhcpGetallOK{} } -/*PcloudDhcpGetallOK handles this case with default header values. +/* PcloudDhcpGetallOK describes a response with status code 200, with default header values. OK */ @@ -67,6 +62,9 @@ type PcloudDhcpGetallOK struct { func (o *PcloudDhcpGetallOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp][%d] pcloudDhcpGetallOK %+v", 200, o.Payload) } +func (o *PcloudDhcpGetallOK) GetPayload() models.DHCPServers { + return o.Payload +} func (o *PcloudDhcpGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -83,7 +81,7 @@ func NewPcloudDhcpGetallForbidden() *PcloudDhcpGetallForbidden { return &PcloudDhcpGetallForbidden{} } -/*PcloudDhcpGetallForbidden handles this case with default header values. +/* PcloudDhcpGetallForbidden describes a response with status code 403, with default header values. Forbidden */ @@ -94,6 +92,9 @@ type PcloudDhcpGetallForbidden struct { func (o *PcloudDhcpGetallForbidden) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp][%d] pcloudDhcpGetallForbidden %+v", 403, o.Payload) } +func (o *PcloudDhcpGetallForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudDhcpGetallForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -112,7 +113,7 @@ func NewPcloudDhcpGetallInternalServerError() *PcloudDhcpGetallInternalServerErr return &PcloudDhcpGetallInternalServerError{} } -/*PcloudDhcpGetallInternalServerError handles this case with default header values. +/* PcloudDhcpGetallInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -123,6 +124,9 @@ type PcloudDhcpGetallInternalServerError struct { func (o *PcloudDhcpGetallInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp][%d] pcloudDhcpGetallInternalServerError %+v", 500, o.Payload) } +func (o *PcloudDhcpGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudDhcpGetallInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_post_parameters.go b/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_post_parameters.go index d38557f0..f665e59b 100644 --- a/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_post_parameters.go +++ b/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_post_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudDhcpPostParams creates a new PcloudDhcpPostParams object -// with the default values initialized. +// NewPcloudDhcpPostParams creates a new PcloudDhcpPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudDhcpPostParams() *PcloudDhcpPostParams { - var () return &PcloudDhcpPostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudDhcpPostParamsWithTimeout creates a new PcloudDhcpPostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudDhcpPostParamsWithTimeout(timeout time.Duration) *PcloudDhcpPostParams { - var () return &PcloudDhcpPostParams{ - timeout: timeout, } } // NewPcloudDhcpPostParamsWithContext creates a new PcloudDhcpPostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudDhcpPostParamsWithContext(ctx context.Context) *PcloudDhcpPostParams { - var () return &PcloudDhcpPostParams{ - Context: ctx, } } // NewPcloudDhcpPostParamsWithHTTPClient creates a new PcloudDhcpPostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudDhcpPostParamsWithHTTPClient(client *http.Client) *PcloudDhcpPostParams { - var () return &PcloudDhcpPostParams{ HTTPClient: client, } } -/*PcloudDhcpPostParams contains all the parameters to send to the API endpoint -for the pcloud dhcp post operation typically these are written to a http.Request +/* PcloudDhcpPostParams contains all the parameters to send to the API endpoint + for the pcloud dhcp post operation. + + Typically these are written to a http.Request. */ type PcloudDhcpPostParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -72,6 +70,21 @@ type PcloudDhcpPostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud dhcp post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudDhcpPostParams) WithDefaults() *PcloudDhcpPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud dhcp post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudDhcpPostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud dhcp post params func (o *PcloudDhcpPostParams) WithTimeout(timeout time.Duration) *PcloudDhcpPostParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_post_responses.go b/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_post_responses.go index 16350666..7b5b6850 100644 --- a/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_post_responses.go +++ b/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudDhcpPostReader is a Reader for the PcloudDhcpPost structure. @@ -24,37 +23,32 @@ type PcloudDhcpPostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudDhcpPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 202: result := NewPcloudDhcpPostAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudDhcpPostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 403: result := NewPcloudDhcpPostForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudDhcpPostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -63,7 +57,7 @@ func NewPcloudDhcpPostAccepted() *PcloudDhcpPostAccepted { return &PcloudDhcpPostAccepted{} } -/*PcloudDhcpPostAccepted handles this case with default header values. +/* PcloudDhcpPostAccepted describes a response with status code 202, with default header values. OK */ @@ -74,6 +68,9 @@ type PcloudDhcpPostAccepted struct { func (o *PcloudDhcpPostAccepted) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp][%d] pcloudDhcpPostAccepted %+v", 202, o.Payload) } +func (o *PcloudDhcpPostAccepted) GetPayload() *models.DHCPServer { + return o.Payload +} func (o *PcloudDhcpPostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -92,7 +89,7 @@ func NewPcloudDhcpPostBadRequest() *PcloudDhcpPostBadRequest { return &PcloudDhcpPostBadRequest{} } -/*PcloudDhcpPostBadRequest handles this case with default header values. +/* PcloudDhcpPostBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -103,6 +100,9 @@ type PcloudDhcpPostBadRequest struct { func (o *PcloudDhcpPostBadRequest) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp][%d] pcloudDhcpPostBadRequest %+v", 400, o.Payload) } +func (o *PcloudDhcpPostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudDhcpPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -121,7 +121,7 @@ func NewPcloudDhcpPostForbidden() *PcloudDhcpPostForbidden { return &PcloudDhcpPostForbidden{} } -/*PcloudDhcpPostForbidden handles this case with default header values. +/* PcloudDhcpPostForbidden describes a response with status code 403, with default header values. Forbidden */ @@ -132,6 +132,9 @@ type PcloudDhcpPostForbidden struct { func (o *PcloudDhcpPostForbidden) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp][%d] pcloudDhcpPostForbidden %+v", 403, o.Payload) } +func (o *PcloudDhcpPostForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudDhcpPostForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -150,7 +153,7 @@ func NewPcloudDhcpPostInternalServerError() *PcloudDhcpPostInternalServerError { return &PcloudDhcpPostInternalServerError{} } -/*PcloudDhcpPostInternalServerError handles this case with default header values. +/* PcloudDhcpPostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -161,6 +164,9 @@ type PcloudDhcpPostInternalServerError struct { func (o *PcloudDhcpPostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp][%d] pcloudDhcpPostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudDhcpPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudDhcpPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_snapshots/p_cloud_snapshots_client.go b/power/client/p_cloud_snapshots/p_cloud_snapshots_client.go index 654163d3..173f4442 100644 --- a/power/client/p_cloud_snapshots/p_cloud_snapshots_client.go +++ b/power/client/p_cloud_snapshots/p_cloud_snapshots_client.go @@ -6,13 +6,14 @@ package p_cloud_snapshots // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/runtime" + "fmt" - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" ) // New creates a new p cloud snapshots API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { return &Client{transport: transport, formats: formats} } @@ -24,16 +25,31 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudCloudinstancesSnapshotsDelete(params *PcloudCloudinstancesSnapshotsDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesSnapshotsDeleteAccepted, error) + + PcloudCloudinstancesSnapshotsGet(params *PcloudCloudinstancesSnapshotsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesSnapshotsGetOK, error) + + PcloudCloudinstancesSnapshotsGetall(params *PcloudCloudinstancesSnapshotsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesSnapshotsGetallOK, error) + + PcloudCloudinstancesSnapshotsPut(params *PcloudCloudinstancesSnapshotsPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesSnapshotsPutOK, error) + + SetTransport(transport runtime.ClientTransport) +} + /* -PcloudCloudinstancesSnapshotsDelete deletes a p VM instance snapshot of a cloud instance + PcloudCloudinstancesSnapshotsDelete deletes a p VM instance snapshot of a cloud instance */ -func (a *Client) PcloudCloudinstancesSnapshotsDelete(params *PcloudCloudinstancesSnapshotsDeleteParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudCloudinstancesSnapshotsDeleteAccepted, error) { +func (a *Client) PcloudCloudinstancesSnapshotsDelete(params *PcloudCloudinstancesSnapshotsDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesSnapshotsDeleteAccepted, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudCloudinstancesSnapshotsDeleteParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.cloudinstances.snapshots.delete", Method: "DELETE", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}", @@ -45,24 +61,34 @@ func (a *Client) PcloudCloudinstancesSnapshotsDelete(params *PcloudCloudinstance AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudCloudinstancesSnapshotsDeleteAccepted), nil - + success, ok := result.(*PcloudCloudinstancesSnapshotsDeleteAccepted) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.cloudinstances.snapshots.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudCloudinstancesSnapshotsGet gets the detail of a snapshot + PcloudCloudinstancesSnapshotsGet gets the detail of a snapshot */ -func (a *Client) PcloudCloudinstancesSnapshotsGet(params *PcloudCloudinstancesSnapshotsGetParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudCloudinstancesSnapshotsGetOK, error) { +func (a *Client) PcloudCloudinstancesSnapshotsGet(params *PcloudCloudinstancesSnapshotsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesSnapshotsGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudCloudinstancesSnapshotsGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.cloudinstances.snapshots.get", Method: "GET", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}", @@ -74,24 +100,34 @@ func (a *Client) PcloudCloudinstancesSnapshotsGet(params *PcloudCloudinstancesSn AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudCloudinstancesSnapshotsGetOK), nil - + success, ok := result.(*PcloudCloudinstancesSnapshotsGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.cloudinstances.snapshots.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudCloudinstancesSnapshotsGetall lists all p VM instance snapshots for this cloud instance + PcloudCloudinstancesSnapshotsGetall lists all p VM instance snapshots for this cloud instance */ -func (a *Client) PcloudCloudinstancesSnapshotsGetall(params *PcloudCloudinstancesSnapshotsGetallParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudCloudinstancesSnapshotsGetallOK, error) { +func (a *Client) PcloudCloudinstancesSnapshotsGetall(params *PcloudCloudinstancesSnapshotsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesSnapshotsGetallOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudCloudinstancesSnapshotsGetallParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.cloudinstances.snapshots.getall", Method: "GET", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots", @@ -103,24 +139,34 @@ func (a *Client) PcloudCloudinstancesSnapshotsGetall(params *PcloudCloudinstance AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudCloudinstancesSnapshotsGetallOK), nil - + success, ok := result.(*PcloudCloudinstancesSnapshotsGetallOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.cloudinstances.snapshots.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudCloudinstancesSnapshotsPut updates a p VM instance snapshot + PcloudCloudinstancesSnapshotsPut updates a p VM instance snapshot */ -func (a *Client) PcloudCloudinstancesSnapshotsPut(params *PcloudCloudinstancesSnapshotsPutParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudCloudinstancesSnapshotsPutOK, error) { +func (a *Client) PcloudCloudinstancesSnapshotsPut(params *PcloudCloudinstancesSnapshotsPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesSnapshotsPutOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudCloudinstancesSnapshotsPutParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.cloudinstances.snapshots.put", Method: "PUT", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}", @@ -132,12 +178,23 @@ func (a *Client) PcloudCloudinstancesSnapshotsPut(params *PcloudCloudinstancesSn AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudCloudinstancesSnapshotsPutOK), nil - + success, ok := result.(*PcloudCloudinstancesSnapshotsPutOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.cloudinstances.snapshots.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } // SetTransport changes the transport on the client diff --git a/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_delete_parameters.go b/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_delete_parameters.go index 3845c354..ce101373 100644 --- a/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_delete_parameters.go +++ b/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_delete_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudCloudinstancesSnapshotsDeleteParams creates a new PcloudCloudinstancesSnapshotsDeleteParams object -// with the default values initialized. +// NewPcloudCloudinstancesSnapshotsDeleteParams creates a new PcloudCloudinstancesSnapshotsDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudCloudinstancesSnapshotsDeleteParams() *PcloudCloudinstancesSnapshotsDeleteParams { - var () return &PcloudCloudinstancesSnapshotsDeleteParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudCloudinstancesSnapshotsDeleteParamsWithTimeout creates a new PcloudCloudinstancesSnapshotsDeleteParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudCloudinstancesSnapshotsDeleteParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesSnapshotsDeleteParams { - var () return &PcloudCloudinstancesSnapshotsDeleteParams{ - timeout: timeout, } } // NewPcloudCloudinstancesSnapshotsDeleteParamsWithContext creates a new PcloudCloudinstancesSnapshotsDeleteParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudCloudinstancesSnapshotsDeleteParamsWithContext(ctx context.Context) *PcloudCloudinstancesSnapshotsDeleteParams { - var () return &PcloudCloudinstancesSnapshotsDeleteParams{ - Context: ctx, } } // NewPcloudCloudinstancesSnapshotsDeleteParamsWithHTTPClient creates a new PcloudCloudinstancesSnapshotsDeleteParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudCloudinstancesSnapshotsDeleteParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesSnapshotsDeleteParams { - var () return &PcloudCloudinstancesSnapshotsDeleteParams{ HTTPClient: client, } } -/*PcloudCloudinstancesSnapshotsDeleteParams contains all the parameters to send to the API endpoint -for the pcloud cloudinstances snapshots delete operation typically these are written to a http.Request +/* PcloudCloudinstancesSnapshotsDeleteParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances snapshots delete operation. + + Typically these are written to a http.Request. */ type PcloudCloudinstancesSnapshotsDeleteParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*SnapshotID - PVM Instance snapshot id + /* SnapshotID. + + PVM Instance snapshot id */ SnapshotID string @@ -77,6 +76,21 @@ type PcloudCloudinstancesSnapshotsDeleteParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud cloudinstances snapshots delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesSnapshotsDeleteParams) WithDefaults() *PcloudCloudinstancesSnapshotsDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances snapshots delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesSnapshotsDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud cloudinstances snapshots delete params func (o *PcloudCloudinstancesSnapshotsDeleteParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesSnapshotsDeleteParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_delete_responses.go b/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_delete_responses.go index d3ad4507..db473201 100644 --- a/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_delete_responses.go +++ b/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_delete_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudCloudinstancesSnapshotsDeleteReader is a Reader for the PcloudCloudinstancesSnapshotsDelete structure. @@ -24,51 +23,44 @@ type PcloudCloudinstancesSnapshotsDeleteReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudCloudinstancesSnapshotsDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 202: result := NewPcloudCloudinstancesSnapshotsDeleteAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudCloudinstancesSnapshotsDeleteBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudCloudinstancesSnapshotsDeleteUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudCloudinstancesSnapshotsDeleteNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 410: result := NewPcloudCloudinstancesSnapshotsDeleteGone() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudCloudinstancesSnapshotsDeleteInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -77,7 +69,7 @@ func NewPcloudCloudinstancesSnapshotsDeleteAccepted() *PcloudCloudinstancesSnaps return &PcloudCloudinstancesSnapshotsDeleteAccepted{} } -/*PcloudCloudinstancesSnapshotsDeleteAccepted handles this case with default header values. +/* PcloudCloudinstancesSnapshotsDeleteAccepted describes a response with status code 202, with default header values. Accepted */ @@ -88,6 +80,9 @@ type PcloudCloudinstancesSnapshotsDeleteAccepted struct { func (o *PcloudCloudinstancesSnapshotsDeleteAccepted) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}][%d] pcloudCloudinstancesSnapshotsDeleteAccepted %+v", 202, o.Payload) } +func (o *PcloudCloudinstancesSnapshotsDeleteAccepted) GetPayload() models.Object { + return o.Payload +} func (o *PcloudCloudinstancesSnapshotsDeleteAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -104,7 +99,7 @@ func NewPcloudCloudinstancesSnapshotsDeleteBadRequest() *PcloudCloudinstancesSna return &PcloudCloudinstancesSnapshotsDeleteBadRequest{} } -/*PcloudCloudinstancesSnapshotsDeleteBadRequest handles this case with default header values. +/* PcloudCloudinstancesSnapshotsDeleteBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -115,6 +110,9 @@ type PcloudCloudinstancesSnapshotsDeleteBadRequest struct { func (o *PcloudCloudinstancesSnapshotsDeleteBadRequest) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}][%d] pcloudCloudinstancesSnapshotsDeleteBadRequest %+v", 400, o.Payload) } +func (o *PcloudCloudinstancesSnapshotsDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesSnapshotsDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -133,7 +131,7 @@ func NewPcloudCloudinstancesSnapshotsDeleteUnauthorized() *PcloudCloudinstancesS return &PcloudCloudinstancesSnapshotsDeleteUnauthorized{} } -/*PcloudCloudinstancesSnapshotsDeleteUnauthorized handles this case with default header values. +/* PcloudCloudinstancesSnapshotsDeleteUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -144,6 +142,9 @@ type PcloudCloudinstancesSnapshotsDeleteUnauthorized struct { func (o *PcloudCloudinstancesSnapshotsDeleteUnauthorized) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}][%d] pcloudCloudinstancesSnapshotsDeleteUnauthorized %+v", 401, o.Payload) } +func (o *PcloudCloudinstancesSnapshotsDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesSnapshotsDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -162,7 +163,7 @@ func NewPcloudCloudinstancesSnapshotsDeleteNotFound() *PcloudCloudinstancesSnaps return &PcloudCloudinstancesSnapshotsDeleteNotFound{} } -/*PcloudCloudinstancesSnapshotsDeleteNotFound handles this case with default header values. +/* PcloudCloudinstancesSnapshotsDeleteNotFound describes a response with status code 404, with default header values. Not Found */ @@ -173,6 +174,9 @@ type PcloudCloudinstancesSnapshotsDeleteNotFound struct { func (o *PcloudCloudinstancesSnapshotsDeleteNotFound) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}][%d] pcloudCloudinstancesSnapshotsDeleteNotFound %+v", 404, o.Payload) } +func (o *PcloudCloudinstancesSnapshotsDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesSnapshotsDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -191,7 +195,7 @@ func NewPcloudCloudinstancesSnapshotsDeleteGone() *PcloudCloudinstancesSnapshots return &PcloudCloudinstancesSnapshotsDeleteGone{} } -/*PcloudCloudinstancesSnapshotsDeleteGone handles this case with default header values. +/* PcloudCloudinstancesSnapshotsDeleteGone describes a response with status code 410, with default header values. Gone */ @@ -202,6 +206,9 @@ type PcloudCloudinstancesSnapshotsDeleteGone struct { func (o *PcloudCloudinstancesSnapshotsDeleteGone) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}][%d] pcloudCloudinstancesSnapshotsDeleteGone %+v", 410, o.Payload) } +func (o *PcloudCloudinstancesSnapshotsDeleteGone) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesSnapshotsDeleteGone) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -220,7 +227,7 @@ func NewPcloudCloudinstancesSnapshotsDeleteInternalServerError() *PcloudCloudins return &PcloudCloudinstancesSnapshotsDeleteInternalServerError{} } -/*PcloudCloudinstancesSnapshotsDeleteInternalServerError handles this case with default header values. +/* PcloudCloudinstancesSnapshotsDeleteInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -231,6 +238,9 @@ type PcloudCloudinstancesSnapshotsDeleteInternalServerError struct { func (o *PcloudCloudinstancesSnapshotsDeleteInternalServerError) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}][%d] pcloudCloudinstancesSnapshotsDeleteInternalServerError %+v", 500, o.Payload) } +func (o *PcloudCloudinstancesSnapshotsDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesSnapshotsDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_get_parameters.go b/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_get_parameters.go index d4805a80..58857dc0 100644 --- a/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_get_parameters.go +++ b/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_get_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudCloudinstancesSnapshotsGetParams creates a new PcloudCloudinstancesSnapshotsGetParams object -// with the default values initialized. +// NewPcloudCloudinstancesSnapshotsGetParams creates a new PcloudCloudinstancesSnapshotsGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudCloudinstancesSnapshotsGetParams() *PcloudCloudinstancesSnapshotsGetParams { - var () return &PcloudCloudinstancesSnapshotsGetParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudCloudinstancesSnapshotsGetParamsWithTimeout creates a new PcloudCloudinstancesSnapshotsGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudCloudinstancesSnapshotsGetParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesSnapshotsGetParams { - var () return &PcloudCloudinstancesSnapshotsGetParams{ - timeout: timeout, } } // NewPcloudCloudinstancesSnapshotsGetParamsWithContext creates a new PcloudCloudinstancesSnapshotsGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudCloudinstancesSnapshotsGetParamsWithContext(ctx context.Context) *PcloudCloudinstancesSnapshotsGetParams { - var () return &PcloudCloudinstancesSnapshotsGetParams{ - Context: ctx, } } // NewPcloudCloudinstancesSnapshotsGetParamsWithHTTPClient creates a new PcloudCloudinstancesSnapshotsGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudCloudinstancesSnapshotsGetParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesSnapshotsGetParams { - var () return &PcloudCloudinstancesSnapshotsGetParams{ HTTPClient: client, } } -/*PcloudCloudinstancesSnapshotsGetParams contains all the parameters to send to the API endpoint -for the pcloud cloudinstances snapshots get operation typically these are written to a http.Request +/* PcloudCloudinstancesSnapshotsGetParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances snapshots get operation. + + Typically these are written to a http.Request. */ type PcloudCloudinstancesSnapshotsGetParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*SnapshotID - PVM Instance snapshot id + /* SnapshotID. + + PVM Instance snapshot id */ SnapshotID string @@ -77,6 +76,21 @@ type PcloudCloudinstancesSnapshotsGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud cloudinstances snapshots get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesSnapshotsGetParams) WithDefaults() *PcloudCloudinstancesSnapshotsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances snapshots get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesSnapshotsGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud cloudinstances snapshots get params func (o *PcloudCloudinstancesSnapshotsGetParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesSnapshotsGetParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_get_responses.go b/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_get_responses.go index fc2265ef..44ebe000 100644 --- a/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_get_responses.go +++ b/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudCloudinstancesSnapshotsGetReader is a Reader for the PcloudCloudinstancesSnapshotsGet structure. @@ -24,44 +23,38 @@ type PcloudCloudinstancesSnapshotsGetReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudCloudinstancesSnapshotsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudCloudinstancesSnapshotsGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudCloudinstancesSnapshotsGetBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudCloudinstancesSnapshotsGetUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudCloudinstancesSnapshotsGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudCloudinstancesSnapshotsGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudCloudinstancesSnapshotsGetOK() *PcloudCloudinstancesSnapshotsGetOK return &PcloudCloudinstancesSnapshotsGetOK{} } -/*PcloudCloudinstancesSnapshotsGetOK handles this case with default header values. +/* PcloudCloudinstancesSnapshotsGetOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudCloudinstancesSnapshotsGetOK struct { func (o *PcloudCloudinstancesSnapshotsGetOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}][%d] pcloudCloudinstancesSnapshotsGetOK %+v", 200, o.Payload) } +func (o *PcloudCloudinstancesSnapshotsGetOK) GetPayload() *models.Snapshot { + return o.Payload +} func (o *PcloudCloudinstancesSnapshotsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudCloudinstancesSnapshotsGetBadRequest() *PcloudCloudinstancesSnapsh return &PcloudCloudinstancesSnapshotsGetBadRequest{} } -/*PcloudCloudinstancesSnapshotsGetBadRequest handles this case with default header values. +/* PcloudCloudinstancesSnapshotsGetBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudCloudinstancesSnapshotsGetBadRequest struct { func (o *PcloudCloudinstancesSnapshotsGetBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}][%d] pcloudCloudinstancesSnapshotsGetBadRequest %+v", 400, o.Payload) } +func (o *PcloudCloudinstancesSnapshotsGetBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesSnapshotsGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudCloudinstancesSnapshotsGetUnauthorized() *PcloudCloudinstancesSnap return &PcloudCloudinstancesSnapshotsGetUnauthorized{} } -/*PcloudCloudinstancesSnapshotsGetUnauthorized handles this case with default header values. +/* PcloudCloudinstancesSnapshotsGetUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudCloudinstancesSnapshotsGetUnauthorized struct { func (o *PcloudCloudinstancesSnapshotsGetUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}][%d] pcloudCloudinstancesSnapshotsGetUnauthorized %+v", 401, o.Payload) } +func (o *PcloudCloudinstancesSnapshotsGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesSnapshotsGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudCloudinstancesSnapshotsGetNotFound() *PcloudCloudinstancesSnapshot return &PcloudCloudinstancesSnapshotsGetNotFound{} } -/*PcloudCloudinstancesSnapshotsGetNotFound handles this case with default header values. +/* PcloudCloudinstancesSnapshotsGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -168,6 +170,9 @@ type PcloudCloudinstancesSnapshotsGetNotFound struct { func (o *PcloudCloudinstancesSnapshotsGetNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}][%d] pcloudCloudinstancesSnapshotsGetNotFound %+v", 404, o.Payload) } +func (o *PcloudCloudinstancesSnapshotsGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesSnapshotsGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudCloudinstancesSnapshotsGetInternalServerError() *PcloudCloudinstan return &PcloudCloudinstancesSnapshotsGetInternalServerError{} } -/*PcloudCloudinstancesSnapshotsGetInternalServerError handles this case with default header values. +/* PcloudCloudinstancesSnapshotsGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudCloudinstancesSnapshotsGetInternalServerError struct { func (o *PcloudCloudinstancesSnapshotsGetInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}][%d] pcloudCloudinstancesSnapshotsGetInternalServerError %+v", 500, o.Payload) } +func (o *PcloudCloudinstancesSnapshotsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesSnapshotsGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_getall_parameters.go b/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_getall_parameters.go index 49294074..281b7062 100644 --- a/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_getall_parameters.go +++ b/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_getall_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudCloudinstancesSnapshotsGetallParams creates a new PcloudCloudinstancesSnapshotsGetallParams object -// with the default values initialized. +// NewPcloudCloudinstancesSnapshotsGetallParams creates a new PcloudCloudinstancesSnapshotsGetallParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudCloudinstancesSnapshotsGetallParams() *PcloudCloudinstancesSnapshotsGetallParams { - var () return &PcloudCloudinstancesSnapshotsGetallParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudCloudinstancesSnapshotsGetallParamsWithTimeout creates a new PcloudCloudinstancesSnapshotsGetallParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudCloudinstancesSnapshotsGetallParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesSnapshotsGetallParams { - var () return &PcloudCloudinstancesSnapshotsGetallParams{ - timeout: timeout, } } // NewPcloudCloudinstancesSnapshotsGetallParamsWithContext creates a new PcloudCloudinstancesSnapshotsGetallParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudCloudinstancesSnapshotsGetallParamsWithContext(ctx context.Context) *PcloudCloudinstancesSnapshotsGetallParams { - var () return &PcloudCloudinstancesSnapshotsGetallParams{ - Context: ctx, } } // NewPcloudCloudinstancesSnapshotsGetallParamsWithHTTPClient creates a new PcloudCloudinstancesSnapshotsGetallParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudCloudinstancesSnapshotsGetallParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesSnapshotsGetallParams { - var () return &PcloudCloudinstancesSnapshotsGetallParams{ HTTPClient: client, } } -/*PcloudCloudinstancesSnapshotsGetallParams contains all the parameters to send to the API endpoint -for the pcloud cloudinstances snapshots getall operation typically these are written to a http.Request +/* PcloudCloudinstancesSnapshotsGetallParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances snapshots getall operation. + + Typically these are written to a http.Request. */ type PcloudCloudinstancesSnapshotsGetallParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -72,6 +70,21 @@ type PcloudCloudinstancesSnapshotsGetallParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud cloudinstances snapshots getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesSnapshotsGetallParams) WithDefaults() *PcloudCloudinstancesSnapshotsGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances snapshots getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesSnapshotsGetallParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud cloudinstances snapshots getall params func (o *PcloudCloudinstancesSnapshotsGetallParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesSnapshotsGetallParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_getall_responses.go b/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_getall_responses.go index 43130ea2..c4dee1b5 100644 --- a/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_getall_responses.go +++ b/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_getall_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudCloudinstancesSnapshotsGetallReader is a Reader for the PcloudCloudinstancesSnapshotsGetall structure. @@ -24,37 +23,32 @@ type PcloudCloudinstancesSnapshotsGetallReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudCloudinstancesSnapshotsGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudCloudinstancesSnapshotsGetallOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudCloudinstancesSnapshotsGetallBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudCloudinstancesSnapshotsGetallUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudCloudinstancesSnapshotsGetallInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -63,7 +57,7 @@ func NewPcloudCloudinstancesSnapshotsGetallOK() *PcloudCloudinstancesSnapshotsGe return &PcloudCloudinstancesSnapshotsGetallOK{} } -/*PcloudCloudinstancesSnapshotsGetallOK handles this case with default header values. +/* PcloudCloudinstancesSnapshotsGetallOK describes a response with status code 200, with default header values. OK */ @@ -74,6 +68,9 @@ type PcloudCloudinstancesSnapshotsGetallOK struct { func (o *PcloudCloudinstancesSnapshotsGetallOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots][%d] pcloudCloudinstancesSnapshotsGetallOK %+v", 200, o.Payload) } +func (o *PcloudCloudinstancesSnapshotsGetallOK) GetPayload() *models.Snapshots { + return o.Payload +} func (o *PcloudCloudinstancesSnapshotsGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -92,7 +89,7 @@ func NewPcloudCloudinstancesSnapshotsGetallBadRequest() *PcloudCloudinstancesSna return &PcloudCloudinstancesSnapshotsGetallBadRequest{} } -/*PcloudCloudinstancesSnapshotsGetallBadRequest handles this case with default header values. +/* PcloudCloudinstancesSnapshotsGetallBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -103,6 +100,9 @@ type PcloudCloudinstancesSnapshotsGetallBadRequest struct { func (o *PcloudCloudinstancesSnapshotsGetallBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots][%d] pcloudCloudinstancesSnapshotsGetallBadRequest %+v", 400, o.Payload) } +func (o *PcloudCloudinstancesSnapshotsGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesSnapshotsGetallBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -121,7 +121,7 @@ func NewPcloudCloudinstancesSnapshotsGetallUnauthorized() *PcloudCloudinstancesS return &PcloudCloudinstancesSnapshotsGetallUnauthorized{} } -/*PcloudCloudinstancesSnapshotsGetallUnauthorized handles this case with default header values. +/* PcloudCloudinstancesSnapshotsGetallUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -132,6 +132,9 @@ type PcloudCloudinstancesSnapshotsGetallUnauthorized struct { func (o *PcloudCloudinstancesSnapshotsGetallUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots][%d] pcloudCloudinstancesSnapshotsGetallUnauthorized %+v", 401, o.Payload) } +func (o *PcloudCloudinstancesSnapshotsGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesSnapshotsGetallUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -150,7 +153,7 @@ func NewPcloudCloudinstancesSnapshotsGetallInternalServerError() *PcloudCloudins return &PcloudCloudinstancesSnapshotsGetallInternalServerError{} } -/*PcloudCloudinstancesSnapshotsGetallInternalServerError handles this case with default header values. +/* PcloudCloudinstancesSnapshotsGetallInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -161,6 +164,9 @@ type PcloudCloudinstancesSnapshotsGetallInternalServerError struct { func (o *PcloudCloudinstancesSnapshotsGetallInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots][%d] pcloudCloudinstancesSnapshotsGetallInternalServerError %+v", 500, o.Payload) } +func (o *PcloudCloudinstancesSnapshotsGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesSnapshotsGetallInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_put_parameters.go b/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_put_parameters.go index 81c6dd13..268a2dfe 100644 --- a/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_put_parameters.go +++ b/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_put_parameters.go @@ -13,69 +13,69 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudCloudinstancesSnapshotsPutParams creates a new PcloudCloudinstancesSnapshotsPutParams object -// with the default values initialized. +// NewPcloudCloudinstancesSnapshotsPutParams creates a new PcloudCloudinstancesSnapshotsPutParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudCloudinstancesSnapshotsPutParams() *PcloudCloudinstancesSnapshotsPutParams { - var () return &PcloudCloudinstancesSnapshotsPutParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudCloudinstancesSnapshotsPutParamsWithTimeout creates a new PcloudCloudinstancesSnapshotsPutParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudCloudinstancesSnapshotsPutParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesSnapshotsPutParams { - var () return &PcloudCloudinstancesSnapshotsPutParams{ - timeout: timeout, } } // NewPcloudCloudinstancesSnapshotsPutParamsWithContext creates a new PcloudCloudinstancesSnapshotsPutParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudCloudinstancesSnapshotsPutParamsWithContext(ctx context.Context) *PcloudCloudinstancesSnapshotsPutParams { - var () return &PcloudCloudinstancesSnapshotsPutParams{ - Context: ctx, } } // NewPcloudCloudinstancesSnapshotsPutParamsWithHTTPClient creates a new PcloudCloudinstancesSnapshotsPutParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudCloudinstancesSnapshotsPutParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesSnapshotsPutParams { - var () return &PcloudCloudinstancesSnapshotsPutParams{ HTTPClient: client, } } -/*PcloudCloudinstancesSnapshotsPutParams contains all the parameters to send to the API endpoint -for the pcloud cloudinstances snapshots put operation typically these are written to a http.Request +/* PcloudCloudinstancesSnapshotsPutParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances snapshots put operation. + + Typically these are written to a http.Request. */ type PcloudCloudinstancesSnapshotsPutParams struct { - /*Body - Parameters for the update of a PVM instance snapshot + /* Body. + Parameters for the update of a PVM instance snapshot */ Body *models.SnapshotUpdate - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*SnapshotID - PVM Instance snapshot id + /* SnapshotID. + + PVM Instance snapshot id */ SnapshotID string @@ -84,6 +84,21 @@ type PcloudCloudinstancesSnapshotsPutParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud cloudinstances snapshots put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesSnapshotsPutParams) WithDefaults() *PcloudCloudinstancesSnapshotsPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances snapshots put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesSnapshotsPutParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud cloudinstances snapshots put params func (o *PcloudCloudinstancesSnapshotsPutParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesSnapshotsPutParams { o.SetTimeout(timeout) @@ -157,7 +172,6 @@ func (o *PcloudCloudinstancesSnapshotsPutParams) WriteToRequest(r runtime.Client return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_put_responses.go b/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_put_responses.go index 9fbccd4c..5dd9d99f 100644 --- a/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_put_responses.go +++ b/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_put_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudCloudinstancesSnapshotsPutReader is a Reader for the PcloudCloudinstancesSnapshotsPut structure. @@ -24,44 +23,38 @@ type PcloudCloudinstancesSnapshotsPutReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudCloudinstancesSnapshotsPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudCloudinstancesSnapshotsPutOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudCloudinstancesSnapshotsPutBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudCloudinstancesSnapshotsPutUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudCloudinstancesSnapshotsPutNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudCloudinstancesSnapshotsPutInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudCloudinstancesSnapshotsPutOK() *PcloudCloudinstancesSnapshotsPutOK return &PcloudCloudinstancesSnapshotsPutOK{} } -/*PcloudCloudinstancesSnapshotsPutOK handles this case with default header values. +/* PcloudCloudinstancesSnapshotsPutOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudCloudinstancesSnapshotsPutOK struct { func (o *PcloudCloudinstancesSnapshotsPutOK) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}][%d] pcloudCloudinstancesSnapshotsPutOK %+v", 200, o.Payload) } +func (o *PcloudCloudinstancesSnapshotsPutOK) GetPayload() models.Object { + return o.Payload +} func (o *PcloudCloudinstancesSnapshotsPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -97,7 +93,7 @@ func NewPcloudCloudinstancesSnapshotsPutBadRequest() *PcloudCloudinstancesSnapsh return &PcloudCloudinstancesSnapshotsPutBadRequest{} } -/*PcloudCloudinstancesSnapshotsPutBadRequest handles this case with default header values. +/* PcloudCloudinstancesSnapshotsPutBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -108,6 +104,9 @@ type PcloudCloudinstancesSnapshotsPutBadRequest struct { func (o *PcloudCloudinstancesSnapshotsPutBadRequest) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}][%d] pcloudCloudinstancesSnapshotsPutBadRequest %+v", 400, o.Payload) } +func (o *PcloudCloudinstancesSnapshotsPutBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesSnapshotsPutBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -126,7 +125,7 @@ func NewPcloudCloudinstancesSnapshotsPutUnauthorized() *PcloudCloudinstancesSnap return &PcloudCloudinstancesSnapshotsPutUnauthorized{} } -/*PcloudCloudinstancesSnapshotsPutUnauthorized handles this case with default header values. +/* PcloudCloudinstancesSnapshotsPutUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -137,6 +136,9 @@ type PcloudCloudinstancesSnapshotsPutUnauthorized struct { func (o *PcloudCloudinstancesSnapshotsPutUnauthorized) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}][%d] pcloudCloudinstancesSnapshotsPutUnauthorized %+v", 401, o.Payload) } +func (o *PcloudCloudinstancesSnapshotsPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesSnapshotsPutUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -155,7 +157,7 @@ func NewPcloudCloudinstancesSnapshotsPutNotFound() *PcloudCloudinstancesSnapshot return &PcloudCloudinstancesSnapshotsPutNotFound{} } -/*PcloudCloudinstancesSnapshotsPutNotFound handles this case with default header values. +/* PcloudCloudinstancesSnapshotsPutNotFound describes a response with status code 404, with default header values. Not Found */ @@ -166,6 +168,9 @@ type PcloudCloudinstancesSnapshotsPutNotFound struct { func (o *PcloudCloudinstancesSnapshotsPutNotFound) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}][%d] pcloudCloudinstancesSnapshotsPutNotFound %+v", 404, o.Payload) } +func (o *PcloudCloudinstancesSnapshotsPutNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesSnapshotsPutNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -184,7 +189,7 @@ func NewPcloudCloudinstancesSnapshotsPutInternalServerError() *PcloudCloudinstan return &PcloudCloudinstancesSnapshotsPutInternalServerError{} } -/*PcloudCloudinstancesSnapshotsPutInternalServerError handles this case with default header values. +/* PcloudCloudinstancesSnapshotsPutInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -195,6 +200,9 @@ type PcloudCloudinstancesSnapshotsPutInternalServerError struct { func (o *PcloudCloudinstancesSnapshotsPutInternalServerError) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}][%d] pcloudCloudinstancesSnapshotsPutInternalServerError %+v", 500, o.Payload) } +func (o *PcloudCloudinstancesSnapshotsPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesSnapshotsPutInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_storage_capacity/p_cloud_storage_capacity_client.go b/power/client/p_cloud_storage_capacity/p_cloud_storage_capacity_client.go index 018a381a..061b5272 100644 --- a/power/client/p_cloud_storage_capacity/p_cloud_storage_capacity_client.go +++ b/power/client/p_cloud_storage_capacity/p_cloud_storage_capacity_client.go @@ -6,13 +6,14 @@ package p_cloud_storage_capacity // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/runtime" + "fmt" - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" ) // New creates a new p cloud storage capacity API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { return &Client{transport: transport, formats: formats} } @@ -24,16 +25,31 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudStoragecapacityPoolsGet(params *PcloudStoragecapacityPoolsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudStoragecapacityPoolsGetOK, error) + + PcloudStoragecapacityPoolsGetall(params *PcloudStoragecapacityPoolsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudStoragecapacityPoolsGetallOK, error) + + PcloudStoragecapacityTypesGet(params *PcloudStoragecapacityTypesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudStoragecapacityTypesGetOK, error) + + PcloudStoragecapacityTypesGetall(params *PcloudStoragecapacityTypesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudStoragecapacityTypesGetallOK, error) + + SetTransport(transport runtime.ClientTransport) +} + /* -PcloudStoragecapacityPoolsGet storages capacity for a storage pool in a region + PcloudStoragecapacityPoolsGet storages capacity for a storage pool in a region */ -func (a *Client) PcloudStoragecapacityPoolsGet(params *PcloudStoragecapacityPoolsGetParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudStoragecapacityPoolsGetOK, error) { +func (a *Client) PcloudStoragecapacityPoolsGet(params *PcloudStoragecapacityPoolsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudStoragecapacityPoolsGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudStoragecapacityPoolsGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.storagecapacity.pools.get", Method: "GET", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-pools/{storage_pool_name}", @@ -45,24 +61,34 @@ func (a *Client) PcloudStoragecapacityPoolsGet(params *PcloudStoragecapacityPool AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudStoragecapacityPoolsGetOK), nil - + success, ok := result.(*PcloudStoragecapacityPoolsGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.storagecapacity.pools.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudStoragecapacityPoolsGetall storages capacity for all available storage pools in a region + PcloudStoragecapacityPoolsGetall storages capacity for all available storage pools in a region */ -func (a *Client) PcloudStoragecapacityPoolsGetall(params *PcloudStoragecapacityPoolsGetallParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudStoragecapacityPoolsGetallOK, error) { +func (a *Client) PcloudStoragecapacityPoolsGetall(params *PcloudStoragecapacityPoolsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudStoragecapacityPoolsGetallOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudStoragecapacityPoolsGetallParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.storagecapacity.pools.getall", Method: "GET", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-pools", @@ -74,24 +100,34 @@ func (a *Client) PcloudStoragecapacityPoolsGetall(params *PcloudStoragecapacityP AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudStoragecapacityPoolsGetallOK), nil - + success, ok := result.(*PcloudStoragecapacityPoolsGetallOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.storagecapacity.pools.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudStoragecapacityTypesGet storages capacity for a storage type in a region + PcloudStoragecapacityTypesGet storages capacity for a storage type in a region */ -func (a *Client) PcloudStoragecapacityTypesGet(params *PcloudStoragecapacityTypesGetParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudStoragecapacityTypesGetOK, error) { +func (a *Client) PcloudStoragecapacityTypesGet(params *PcloudStoragecapacityTypesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudStoragecapacityTypesGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudStoragecapacityTypesGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.storagecapacity.types.get", Method: "GET", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-types/{storage_type_name}", @@ -103,24 +139,34 @@ func (a *Client) PcloudStoragecapacityTypesGet(params *PcloudStoragecapacityType AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudStoragecapacityTypesGetOK), nil - + success, ok := result.(*PcloudStoragecapacityTypesGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.storagecapacity.types.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudStoragecapacityTypesGetall storages capacity for all available storage types in a region + PcloudStoragecapacityTypesGetall storages capacity for all available storage types in a region */ -func (a *Client) PcloudStoragecapacityTypesGetall(params *PcloudStoragecapacityTypesGetallParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudStoragecapacityTypesGetallOK, error) { +func (a *Client) PcloudStoragecapacityTypesGetall(params *PcloudStoragecapacityTypesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudStoragecapacityTypesGetallOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudStoragecapacityTypesGetallParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.storagecapacity.types.getall", Method: "GET", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-types", @@ -132,12 +178,23 @@ func (a *Client) PcloudStoragecapacityTypesGetall(params *PcloudStoragecapacityT AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudStoragecapacityTypesGetallOK), nil - + success, ok := result.(*PcloudStoragecapacityTypesGetallOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.storagecapacity.types.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } // SetTransport changes the transport on the client diff --git a/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_pools_get_parameters.go b/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_pools_get_parameters.go index 76ee684f..c2d5df80 100644 --- a/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_pools_get_parameters.go +++ b/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_pools_get_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudStoragecapacityPoolsGetParams creates a new PcloudStoragecapacityPoolsGetParams object -// with the default values initialized. +// NewPcloudStoragecapacityPoolsGetParams creates a new PcloudStoragecapacityPoolsGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudStoragecapacityPoolsGetParams() *PcloudStoragecapacityPoolsGetParams { - var () return &PcloudStoragecapacityPoolsGetParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudStoragecapacityPoolsGetParamsWithTimeout creates a new PcloudStoragecapacityPoolsGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudStoragecapacityPoolsGetParamsWithTimeout(timeout time.Duration) *PcloudStoragecapacityPoolsGetParams { - var () return &PcloudStoragecapacityPoolsGetParams{ - timeout: timeout, } } // NewPcloudStoragecapacityPoolsGetParamsWithContext creates a new PcloudStoragecapacityPoolsGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudStoragecapacityPoolsGetParamsWithContext(ctx context.Context) *PcloudStoragecapacityPoolsGetParams { - var () return &PcloudStoragecapacityPoolsGetParams{ - Context: ctx, } } // NewPcloudStoragecapacityPoolsGetParamsWithHTTPClient creates a new PcloudStoragecapacityPoolsGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudStoragecapacityPoolsGetParamsWithHTTPClient(client *http.Client) *PcloudStoragecapacityPoolsGetParams { - var () return &PcloudStoragecapacityPoolsGetParams{ HTTPClient: client, } } -/*PcloudStoragecapacityPoolsGetParams contains all the parameters to send to the API endpoint -for the pcloud storagecapacity pools get operation typically these are written to a http.Request +/* PcloudStoragecapacityPoolsGetParams contains all the parameters to send to the API endpoint + for the pcloud storagecapacity pools get operation. + + Typically these are written to a http.Request. */ type PcloudStoragecapacityPoolsGetParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*StoragePoolName - Storage pool name + /* StoragePoolName. + + Storage pool name */ StoragePoolName string @@ -77,6 +76,21 @@ type PcloudStoragecapacityPoolsGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud storagecapacity pools get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudStoragecapacityPoolsGetParams) WithDefaults() *PcloudStoragecapacityPoolsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud storagecapacity pools get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudStoragecapacityPoolsGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud storagecapacity pools get params func (o *PcloudStoragecapacityPoolsGetParams) WithTimeout(timeout time.Duration) *PcloudStoragecapacityPoolsGetParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_pools_get_responses.go b/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_pools_get_responses.go index 862c1a63..d6abdcf9 100644 --- a/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_pools_get_responses.go +++ b/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_pools_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudStoragecapacityPoolsGetReader is a Reader for the PcloudStoragecapacityPoolsGet structure. @@ -24,37 +23,32 @@ type PcloudStoragecapacityPoolsGetReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudStoragecapacityPoolsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudStoragecapacityPoolsGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 401: result := NewPcloudStoragecapacityPoolsGetUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudStoragecapacityPoolsGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudStoragecapacityPoolsGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -63,7 +57,7 @@ func NewPcloudStoragecapacityPoolsGetOK() *PcloudStoragecapacityPoolsGetOK { return &PcloudStoragecapacityPoolsGetOK{} } -/*PcloudStoragecapacityPoolsGetOK handles this case with default header values. +/* PcloudStoragecapacityPoolsGetOK describes a response with status code 200, with default header values. OK */ @@ -74,6 +68,9 @@ type PcloudStoragecapacityPoolsGetOK struct { func (o *PcloudStoragecapacityPoolsGetOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-pools/{storage_pool_name}][%d] pcloudStoragecapacityPoolsGetOK %+v", 200, o.Payload) } +func (o *PcloudStoragecapacityPoolsGetOK) GetPayload() *models.StoragePoolCapacity { + return o.Payload +} func (o *PcloudStoragecapacityPoolsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -92,7 +89,7 @@ func NewPcloudStoragecapacityPoolsGetUnauthorized() *PcloudStoragecapacityPoolsG return &PcloudStoragecapacityPoolsGetUnauthorized{} } -/*PcloudStoragecapacityPoolsGetUnauthorized handles this case with default header values. +/* PcloudStoragecapacityPoolsGetUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -103,6 +100,9 @@ type PcloudStoragecapacityPoolsGetUnauthorized struct { func (o *PcloudStoragecapacityPoolsGetUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-pools/{storage_pool_name}][%d] pcloudStoragecapacityPoolsGetUnauthorized %+v", 401, o.Payload) } +func (o *PcloudStoragecapacityPoolsGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudStoragecapacityPoolsGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -121,7 +121,7 @@ func NewPcloudStoragecapacityPoolsGetNotFound() *PcloudStoragecapacityPoolsGetNo return &PcloudStoragecapacityPoolsGetNotFound{} } -/*PcloudStoragecapacityPoolsGetNotFound handles this case with default header values. +/* PcloudStoragecapacityPoolsGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -132,6 +132,9 @@ type PcloudStoragecapacityPoolsGetNotFound struct { func (o *PcloudStoragecapacityPoolsGetNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-pools/{storage_pool_name}][%d] pcloudStoragecapacityPoolsGetNotFound %+v", 404, o.Payload) } +func (o *PcloudStoragecapacityPoolsGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudStoragecapacityPoolsGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -150,7 +153,7 @@ func NewPcloudStoragecapacityPoolsGetInternalServerError() *PcloudStoragecapacit return &PcloudStoragecapacityPoolsGetInternalServerError{} } -/*PcloudStoragecapacityPoolsGetInternalServerError handles this case with default header values. +/* PcloudStoragecapacityPoolsGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -161,6 +164,9 @@ type PcloudStoragecapacityPoolsGetInternalServerError struct { func (o *PcloudStoragecapacityPoolsGetInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-pools/{storage_pool_name}][%d] pcloudStoragecapacityPoolsGetInternalServerError %+v", 500, o.Payload) } +func (o *PcloudStoragecapacityPoolsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudStoragecapacityPoolsGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_pools_getall_parameters.go b/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_pools_getall_parameters.go index 0bb1b764..e955e007 100644 --- a/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_pools_getall_parameters.go +++ b/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_pools_getall_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudStoragecapacityPoolsGetallParams creates a new PcloudStoragecapacityPoolsGetallParams object -// with the default values initialized. +// NewPcloudStoragecapacityPoolsGetallParams creates a new PcloudStoragecapacityPoolsGetallParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudStoragecapacityPoolsGetallParams() *PcloudStoragecapacityPoolsGetallParams { - var () return &PcloudStoragecapacityPoolsGetallParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudStoragecapacityPoolsGetallParamsWithTimeout creates a new PcloudStoragecapacityPoolsGetallParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudStoragecapacityPoolsGetallParamsWithTimeout(timeout time.Duration) *PcloudStoragecapacityPoolsGetallParams { - var () return &PcloudStoragecapacityPoolsGetallParams{ - timeout: timeout, } } // NewPcloudStoragecapacityPoolsGetallParamsWithContext creates a new PcloudStoragecapacityPoolsGetallParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudStoragecapacityPoolsGetallParamsWithContext(ctx context.Context) *PcloudStoragecapacityPoolsGetallParams { - var () return &PcloudStoragecapacityPoolsGetallParams{ - Context: ctx, } } // NewPcloudStoragecapacityPoolsGetallParamsWithHTTPClient creates a new PcloudStoragecapacityPoolsGetallParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudStoragecapacityPoolsGetallParamsWithHTTPClient(client *http.Client) *PcloudStoragecapacityPoolsGetallParams { - var () return &PcloudStoragecapacityPoolsGetallParams{ HTTPClient: client, } } -/*PcloudStoragecapacityPoolsGetallParams contains all the parameters to send to the API endpoint -for the pcloud storagecapacity pools getall operation typically these are written to a http.Request +/* PcloudStoragecapacityPoolsGetallParams contains all the parameters to send to the API endpoint + for the pcloud storagecapacity pools getall operation. + + Typically these are written to a http.Request. */ type PcloudStoragecapacityPoolsGetallParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -72,6 +70,21 @@ type PcloudStoragecapacityPoolsGetallParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud storagecapacity pools getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudStoragecapacityPoolsGetallParams) WithDefaults() *PcloudStoragecapacityPoolsGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud storagecapacity pools getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudStoragecapacityPoolsGetallParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud storagecapacity pools getall params func (o *PcloudStoragecapacityPoolsGetallParams) WithTimeout(timeout time.Duration) *PcloudStoragecapacityPoolsGetallParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_pools_getall_responses.go b/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_pools_getall_responses.go index f62b5831..6aa16ffe 100644 --- a/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_pools_getall_responses.go +++ b/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_pools_getall_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudStoragecapacityPoolsGetallReader is a Reader for the PcloudStoragecapacityPoolsGetall structure. @@ -24,30 +23,26 @@ type PcloudStoragecapacityPoolsGetallReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudStoragecapacityPoolsGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudStoragecapacityPoolsGetallOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 401: result := NewPcloudStoragecapacityPoolsGetallUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudStoragecapacityPoolsGetallInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -56,7 +51,7 @@ func NewPcloudStoragecapacityPoolsGetallOK() *PcloudStoragecapacityPoolsGetallOK return &PcloudStoragecapacityPoolsGetallOK{} } -/*PcloudStoragecapacityPoolsGetallOK handles this case with default header values. +/* PcloudStoragecapacityPoolsGetallOK describes a response with status code 200, with default header values. OK */ @@ -67,6 +62,9 @@ type PcloudStoragecapacityPoolsGetallOK struct { func (o *PcloudStoragecapacityPoolsGetallOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-pools][%d] pcloudStoragecapacityPoolsGetallOK %+v", 200, o.Payload) } +func (o *PcloudStoragecapacityPoolsGetallOK) GetPayload() *models.StoragePoolsCapacity { + return o.Payload +} func (o *PcloudStoragecapacityPoolsGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -85,7 +83,7 @@ func NewPcloudStoragecapacityPoolsGetallUnauthorized() *PcloudStoragecapacityPoo return &PcloudStoragecapacityPoolsGetallUnauthorized{} } -/*PcloudStoragecapacityPoolsGetallUnauthorized handles this case with default header values. +/* PcloudStoragecapacityPoolsGetallUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -96,6 +94,9 @@ type PcloudStoragecapacityPoolsGetallUnauthorized struct { func (o *PcloudStoragecapacityPoolsGetallUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-pools][%d] pcloudStoragecapacityPoolsGetallUnauthorized %+v", 401, o.Payload) } +func (o *PcloudStoragecapacityPoolsGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudStoragecapacityPoolsGetallUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -114,7 +115,7 @@ func NewPcloudStoragecapacityPoolsGetallInternalServerError() *PcloudStoragecapa return &PcloudStoragecapacityPoolsGetallInternalServerError{} } -/*PcloudStoragecapacityPoolsGetallInternalServerError handles this case with default header values. +/* PcloudStoragecapacityPoolsGetallInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -125,6 +126,9 @@ type PcloudStoragecapacityPoolsGetallInternalServerError struct { func (o *PcloudStoragecapacityPoolsGetallInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-pools][%d] pcloudStoragecapacityPoolsGetallInternalServerError %+v", 500, o.Payload) } +func (o *PcloudStoragecapacityPoolsGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudStoragecapacityPoolsGetallInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_types_get_parameters.go b/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_types_get_parameters.go index 372a17a7..51f3bb9b 100644 --- a/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_types_get_parameters.go +++ b/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_types_get_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudStoragecapacityTypesGetParams creates a new PcloudStoragecapacityTypesGetParams object -// with the default values initialized. +// NewPcloudStoragecapacityTypesGetParams creates a new PcloudStoragecapacityTypesGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudStoragecapacityTypesGetParams() *PcloudStoragecapacityTypesGetParams { - var () return &PcloudStoragecapacityTypesGetParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudStoragecapacityTypesGetParamsWithTimeout creates a new PcloudStoragecapacityTypesGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudStoragecapacityTypesGetParamsWithTimeout(timeout time.Duration) *PcloudStoragecapacityTypesGetParams { - var () return &PcloudStoragecapacityTypesGetParams{ - timeout: timeout, } } // NewPcloudStoragecapacityTypesGetParamsWithContext creates a new PcloudStoragecapacityTypesGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudStoragecapacityTypesGetParamsWithContext(ctx context.Context) *PcloudStoragecapacityTypesGetParams { - var () return &PcloudStoragecapacityTypesGetParams{ - Context: ctx, } } // NewPcloudStoragecapacityTypesGetParamsWithHTTPClient creates a new PcloudStoragecapacityTypesGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudStoragecapacityTypesGetParamsWithHTTPClient(client *http.Client) *PcloudStoragecapacityTypesGetParams { - var () return &PcloudStoragecapacityTypesGetParams{ HTTPClient: client, } } -/*PcloudStoragecapacityTypesGetParams contains all the parameters to send to the API endpoint -for the pcloud storagecapacity types get operation typically these are written to a http.Request +/* PcloudStoragecapacityTypesGetParams contains all the parameters to send to the API endpoint + for the pcloud storagecapacity types get operation. + + Typically these are written to a http.Request. */ type PcloudStoragecapacityTypesGetParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*StorageTypeName - Storage type name + /* StorageTypeName. + + Storage type name */ StorageTypeName string @@ -77,6 +76,21 @@ type PcloudStoragecapacityTypesGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud storagecapacity types get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudStoragecapacityTypesGetParams) WithDefaults() *PcloudStoragecapacityTypesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud storagecapacity types get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudStoragecapacityTypesGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud storagecapacity types get params func (o *PcloudStoragecapacityTypesGetParams) WithTimeout(timeout time.Duration) *PcloudStoragecapacityTypesGetParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_types_get_responses.go b/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_types_get_responses.go index 0ff52a04..3623f47c 100644 --- a/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_types_get_responses.go +++ b/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_types_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudStoragecapacityTypesGetReader is a Reader for the PcloudStoragecapacityTypesGet structure. @@ -24,37 +23,32 @@ type PcloudStoragecapacityTypesGetReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudStoragecapacityTypesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudStoragecapacityTypesGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 401: result := NewPcloudStoragecapacityTypesGetUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudStoragecapacityTypesGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudStoragecapacityTypesGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -63,7 +57,7 @@ func NewPcloudStoragecapacityTypesGetOK() *PcloudStoragecapacityTypesGetOK { return &PcloudStoragecapacityTypesGetOK{} } -/*PcloudStoragecapacityTypesGetOK handles this case with default header values. +/* PcloudStoragecapacityTypesGetOK describes a response with status code 200, with default header values. OK */ @@ -74,6 +68,9 @@ type PcloudStoragecapacityTypesGetOK struct { func (o *PcloudStoragecapacityTypesGetOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-types/{storage_type_name}][%d] pcloudStoragecapacityTypesGetOK %+v", 200, o.Payload) } +func (o *PcloudStoragecapacityTypesGetOK) GetPayload() *models.StorageTypeCapacity { + return o.Payload +} func (o *PcloudStoragecapacityTypesGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -92,7 +89,7 @@ func NewPcloudStoragecapacityTypesGetUnauthorized() *PcloudStoragecapacityTypesG return &PcloudStoragecapacityTypesGetUnauthorized{} } -/*PcloudStoragecapacityTypesGetUnauthorized handles this case with default header values. +/* PcloudStoragecapacityTypesGetUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -103,6 +100,9 @@ type PcloudStoragecapacityTypesGetUnauthorized struct { func (o *PcloudStoragecapacityTypesGetUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-types/{storage_type_name}][%d] pcloudStoragecapacityTypesGetUnauthorized %+v", 401, o.Payload) } +func (o *PcloudStoragecapacityTypesGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudStoragecapacityTypesGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -121,7 +121,7 @@ func NewPcloudStoragecapacityTypesGetNotFound() *PcloudStoragecapacityTypesGetNo return &PcloudStoragecapacityTypesGetNotFound{} } -/*PcloudStoragecapacityTypesGetNotFound handles this case with default header values. +/* PcloudStoragecapacityTypesGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -132,6 +132,9 @@ type PcloudStoragecapacityTypesGetNotFound struct { func (o *PcloudStoragecapacityTypesGetNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-types/{storage_type_name}][%d] pcloudStoragecapacityTypesGetNotFound %+v", 404, o.Payload) } +func (o *PcloudStoragecapacityTypesGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudStoragecapacityTypesGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -150,7 +153,7 @@ func NewPcloudStoragecapacityTypesGetInternalServerError() *PcloudStoragecapacit return &PcloudStoragecapacityTypesGetInternalServerError{} } -/*PcloudStoragecapacityTypesGetInternalServerError handles this case with default header values. +/* PcloudStoragecapacityTypesGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -161,6 +164,9 @@ type PcloudStoragecapacityTypesGetInternalServerError struct { func (o *PcloudStoragecapacityTypesGetInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-types/{storage_type_name}][%d] pcloudStoragecapacityTypesGetInternalServerError %+v", 500, o.Payload) } +func (o *PcloudStoragecapacityTypesGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudStoragecapacityTypesGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_types_getall_parameters.go b/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_types_getall_parameters.go index 155f4758..50519ea2 100644 --- a/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_types_getall_parameters.go +++ b/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_types_getall_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudStoragecapacityTypesGetallParams creates a new PcloudStoragecapacityTypesGetallParams object -// with the default values initialized. +// NewPcloudStoragecapacityTypesGetallParams creates a new PcloudStoragecapacityTypesGetallParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudStoragecapacityTypesGetallParams() *PcloudStoragecapacityTypesGetallParams { - var () return &PcloudStoragecapacityTypesGetallParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudStoragecapacityTypesGetallParamsWithTimeout creates a new PcloudStoragecapacityTypesGetallParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudStoragecapacityTypesGetallParamsWithTimeout(timeout time.Duration) *PcloudStoragecapacityTypesGetallParams { - var () return &PcloudStoragecapacityTypesGetallParams{ - timeout: timeout, } } // NewPcloudStoragecapacityTypesGetallParamsWithContext creates a new PcloudStoragecapacityTypesGetallParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudStoragecapacityTypesGetallParamsWithContext(ctx context.Context) *PcloudStoragecapacityTypesGetallParams { - var () return &PcloudStoragecapacityTypesGetallParams{ - Context: ctx, } } // NewPcloudStoragecapacityTypesGetallParamsWithHTTPClient creates a new PcloudStoragecapacityTypesGetallParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudStoragecapacityTypesGetallParamsWithHTTPClient(client *http.Client) *PcloudStoragecapacityTypesGetallParams { - var () return &PcloudStoragecapacityTypesGetallParams{ HTTPClient: client, } } -/*PcloudStoragecapacityTypesGetallParams contains all the parameters to send to the API endpoint -for the pcloud storagecapacity types getall operation typically these are written to a http.Request +/* PcloudStoragecapacityTypesGetallParams contains all the parameters to send to the API endpoint + for the pcloud storagecapacity types getall operation. + + Typically these are written to a http.Request. */ type PcloudStoragecapacityTypesGetallParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -72,6 +70,21 @@ type PcloudStoragecapacityTypesGetallParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud storagecapacity types getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudStoragecapacityTypesGetallParams) WithDefaults() *PcloudStoragecapacityTypesGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud storagecapacity types getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudStoragecapacityTypesGetallParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud storagecapacity types getall params func (o *PcloudStoragecapacityTypesGetallParams) WithTimeout(timeout time.Duration) *PcloudStoragecapacityTypesGetallParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_types_getall_responses.go b/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_types_getall_responses.go index 88467e7d..97595cd3 100644 --- a/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_types_getall_responses.go +++ b/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_types_getall_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudStoragecapacityTypesGetallReader is a Reader for the PcloudStoragecapacityTypesGetall structure. @@ -24,30 +23,26 @@ type PcloudStoragecapacityTypesGetallReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudStoragecapacityTypesGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudStoragecapacityTypesGetallOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 401: result := NewPcloudStoragecapacityTypesGetallUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudStoragecapacityTypesGetallInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -56,7 +51,7 @@ func NewPcloudStoragecapacityTypesGetallOK() *PcloudStoragecapacityTypesGetallOK return &PcloudStoragecapacityTypesGetallOK{} } -/*PcloudStoragecapacityTypesGetallOK handles this case with default header values. +/* PcloudStoragecapacityTypesGetallOK describes a response with status code 200, with default header values. OK */ @@ -67,6 +62,9 @@ type PcloudStoragecapacityTypesGetallOK struct { func (o *PcloudStoragecapacityTypesGetallOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-types][%d] pcloudStoragecapacityTypesGetallOK %+v", 200, o.Payload) } +func (o *PcloudStoragecapacityTypesGetallOK) GetPayload() *models.StorageTypesCapacity { + return o.Payload +} func (o *PcloudStoragecapacityTypesGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -85,7 +83,7 @@ func NewPcloudStoragecapacityTypesGetallUnauthorized() *PcloudStoragecapacityTyp return &PcloudStoragecapacityTypesGetallUnauthorized{} } -/*PcloudStoragecapacityTypesGetallUnauthorized handles this case with default header values. +/* PcloudStoragecapacityTypesGetallUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -96,6 +94,9 @@ type PcloudStoragecapacityTypesGetallUnauthorized struct { func (o *PcloudStoragecapacityTypesGetallUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-types][%d] pcloudStoragecapacityTypesGetallUnauthorized %+v", 401, o.Payload) } +func (o *PcloudStoragecapacityTypesGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudStoragecapacityTypesGetallUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -114,7 +115,7 @@ func NewPcloudStoragecapacityTypesGetallInternalServerError() *PcloudStoragecapa return &PcloudStoragecapacityTypesGetallInternalServerError{} } -/*PcloudStoragecapacityTypesGetallInternalServerError handles this case with default header values. +/* PcloudStoragecapacityTypesGetallInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -125,6 +126,9 @@ type PcloudStoragecapacityTypesGetallInternalServerError struct { func (o *PcloudStoragecapacityTypesGetallInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-types][%d] pcloudStoragecapacityTypesGetallInternalServerError %+v", 500, o.Payload) } +func (o *PcloudStoragecapacityTypesGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudStoragecapacityTypesGetallInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_system_pools/p_cloud_system_pools_client.go b/power/client/p_cloud_system_pools/p_cloud_system_pools_client.go index 6a3909dc..a94da9c2 100644 --- a/power/client/p_cloud_system_pools/p_cloud_system_pools_client.go +++ b/power/client/p_cloud_system_pools/p_cloud_system_pools_client.go @@ -6,13 +6,14 @@ package p_cloud_system_pools // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/runtime" + "fmt" - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" ) // New creates a new p cloud system pools API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { return &Client{transport: transport, formats: formats} } @@ -24,16 +25,25 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudSystempoolsGet(params *PcloudSystempoolsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudSystempoolsGetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + /* -PcloudSystempoolsGet lists of available system pools within a particular data center + PcloudSystempoolsGet lists of available system pools within a particular data center */ -func (a *Client) PcloudSystempoolsGet(params *PcloudSystempoolsGetParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudSystempoolsGetOK, error) { +func (a *Client) PcloudSystempoolsGet(params *PcloudSystempoolsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudSystempoolsGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudSystempoolsGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.systempools.get", Method: "GET", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/system-pools", @@ -45,12 +55,23 @@ func (a *Client) PcloudSystempoolsGet(params *PcloudSystempoolsGetParams, authIn AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudSystempoolsGetOK), nil - + success, ok := result.(*PcloudSystempoolsGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.systempools.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } // SetTransport changes the transport on the client diff --git a/power/client/p_cloud_system_pools/pcloud_systempools_get_parameters.go b/power/client/p_cloud_system_pools/pcloud_systempools_get_parameters.go index 842b8b6c..a727b64e 100644 --- a/power/client/p_cloud_system_pools/pcloud_systempools_get_parameters.go +++ b/power/client/p_cloud_system_pools/pcloud_systempools_get_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudSystempoolsGetParams creates a new PcloudSystempoolsGetParams object -// with the default values initialized. +// NewPcloudSystempoolsGetParams creates a new PcloudSystempoolsGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudSystempoolsGetParams() *PcloudSystempoolsGetParams { - var () return &PcloudSystempoolsGetParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudSystempoolsGetParamsWithTimeout creates a new PcloudSystempoolsGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudSystempoolsGetParamsWithTimeout(timeout time.Duration) *PcloudSystempoolsGetParams { - var () return &PcloudSystempoolsGetParams{ - timeout: timeout, } } // NewPcloudSystempoolsGetParamsWithContext creates a new PcloudSystempoolsGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudSystempoolsGetParamsWithContext(ctx context.Context) *PcloudSystempoolsGetParams { - var () return &PcloudSystempoolsGetParams{ - Context: ctx, } } // NewPcloudSystempoolsGetParamsWithHTTPClient creates a new PcloudSystempoolsGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudSystempoolsGetParamsWithHTTPClient(client *http.Client) *PcloudSystempoolsGetParams { - var () return &PcloudSystempoolsGetParams{ HTTPClient: client, } } -/*PcloudSystempoolsGetParams contains all the parameters to send to the API endpoint -for the pcloud systempools get operation typically these are written to a http.Request +/* PcloudSystempoolsGetParams contains all the parameters to send to the API endpoint + for the pcloud systempools get operation. + + Typically these are written to a http.Request. */ type PcloudSystempoolsGetParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -72,6 +70,21 @@ type PcloudSystempoolsGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud systempools get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudSystempoolsGetParams) WithDefaults() *PcloudSystempoolsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud systempools get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudSystempoolsGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud systempools get params func (o *PcloudSystempoolsGetParams) WithTimeout(timeout time.Duration) *PcloudSystempoolsGetParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_system_pools/pcloud_systempools_get_responses.go b/power/client/p_cloud_system_pools/pcloud_systempools_get_responses.go index 2f5aec49..78089d7a 100644 --- a/power/client/p_cloud_system_pools/pcloud_systempools_get_responses.go +++ b/power/client/p_cloud_system_pools/pcloud_systempools_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudSystempoolsGetReader is a Reader for the PcloudSystempoolsGet structure. @@ -24,30 +23,26 @@ type PcloudSystempoolsGetReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudSystempoolsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudSystempoolsGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 401: result := NewPcloudSystempoolsGetUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudSystempoolsGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -56,7 +51,7 @@ func NewPcloudSystempoolsGetOK() *PcloudSystempoolsGetOK { return &PcloudSystempoolsGetOK{} } -/*PcloudSystempoolsGetOK handles this case with default header values. +/* PcloudSystempoolsGetOK describes a response with status code 200, with default header values. OK */ @@ -67,6 +62,9 @@ type PcloudSystempoolsGetOK struct { func (o *PcloudSystempoolsGetOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/system-pools][%d] pcloudSystempoolsGetOK %+v", 200, o.Payload) } +func (o *PcloudSystempoolsGetOK) GetPayload() models.SystemPools { + return o.Payload +} func (o *PcloudSystempoolsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -83,7 +81,7 @@ func NewPcloudSystempoolsGetUnauthorized() *PcloudSystempoolsGetUnauthorized { return &PcloudSystempoolsGetUnauthorized{} } -/*PcloudSystempoolsGetUnauthorized handles this case with default header values. +/* PcloudSystempoolsGetUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -94,6 +92,9 @@ type PcloudSystempoolsGetUnauthorized struct { func (o *PcloudSystempoolsGetUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/system-pools][%d] pcloudSystempoolsGetUnauthorized %+v", 401, o.Payload) } +func (o *PcloudSystempoolsGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudSystempoolsGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -112,7 +113,7 @@ func NewPcloudSystempoolsGetInternalServerError() *PcloudSystempoolsGetInternalS return &PcloudSystempoolsGetInternalServerError{} } -/*PcloudSystempoolsGetInternalServerError handles this case with default header values. +/* PcloudSystempoolsGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -123,6 +124,9 @@ type PcloudSystempoolsGetInternalServerError struct { func (o *PcloudSystempoolsGetInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/system-pools][%d] pcloudSystempoolsGetInternalServerError %+v", 500, o.Payload) } +func (o *PcloudSystempoolsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudSystempoolsGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_tasks/p_cloud_tasks_client.go b/power/client/p_cloud_tasks/p_cloud_tasks_client.go index a9696ec2..22d71e5e 100644 --- a/power/client/p_cloud_tasks/p_cloud_tasks_client.go +++ b/power/client/p_cloud_tasks/p_cloud_tasks_client.go @@ -6,13 +6,14 @@ package p_cloud_tasks // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/runtime" + "fmt" - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" ) // New creates a new p cloud tasks API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { return &Client{transport: transport, formats: formats} } @@ -24,16 +25,27 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudTasksDelete(params *PcloudTasksDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTasksDeleteOK, error) + + PcloudTasksGet(params *PcloudTasksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTasksGetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + /* -PcloudTasksDelete deletes a task + PcloudTasksDelete deletes a task */ -func (a *Client) PcloudTasksDelete(params *PcloudTasksDeleteParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudTasksDeleteOK, error) { +func (a *Client) PcloudTasksDelete(params *PcloudTasksDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTasksDeleteOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudTasksDeleteParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.tasks.delete", Method: "DELETE", PathPattern: "/pcloud/v1/tasks/{task_id}", @@ -45,24 +57,34 @@ func (a *Client) PcloudTasksDelete(params *PcloudTasksDeleteParams, authInfo run AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudTasksDeleteOK), nil - + success, ok := result.(*PcloudTasksDeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.tasks.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudTasksGet gets a task + PcloudTasksGet gets a task */ -func (a *Client) PcloudTasksGet(params *PcloudTasksGetParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudTasksGetOK, error) { +func (a *Client) PcloudTasksGet(params *PcloudTasksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTasksGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudTasksGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.tasks.get", Method: "GET", PathPattern: "/pcloud/v1/tasks/{task_id}", @@ -74,12 +96,23 @@ func (a *Client) PcloudTasksGet(params *PcloudTasksGetParams, authInfo runtime.C AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudTasksGetOK), nil - + success, ok := result.(*PcloudTasksGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.tasks.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } // SetTransport changes the transport on the client diff --git a/power/client/p_cloud_tasks/pcloud_tasks_delete_parameters.go b/power/client/p_cloud_tasks/pcloud_tasks_delete_parameters.go index 8fda12b0..641d712b 100644 --- a/power/client/p_cloud_tasks/pcloud_tasks_delete_parameters.go +++ b/power/client/p_cloud_tasks/pcloud_tasks_delete_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudTasksDeleteParams creates a new PcloudTasksDeleteParams object -// with the default values initialized. +// NewPcloudTasksDeleteParams creates a new PcloudTasksDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudTasksDeleteParams() *PcloudTasksDeleteParams { - var () return &PcloudTasksDeleteParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudTasksDeleteParamsWithTimeout creates a new PcloudTasksDeleteParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudTasksDeleteParamsWithTimeout(timeout time.Duration) *PcloudTasksDeleteParams { - var () return &PcloudTasksDeleteParams{ - timeout: timeout, } } // NewPcloudTasksDeleteParamsWithContext creates a new PcloudTasksDeleteParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudTasksDeleteParamsWithContext(ctx context.Context) *PcloudTasksDeleteParams { - var () return &PcloudTasksDeleteParams{ - Context: ctx, } } // NewPcloudTasksDeleteParamsWithHTTPClient creates a new PcloudTasksDeleteParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudTasksDeleteParamsWithHTTPClient(client *http.Client) *PcloudTasksDeleteParams { - var () return &PcloudTasksDeleteParams{ HTTPClient: client, } } -/*PcloudTasksDeleteParams contains all the parameters to send to the API endpoint -for the pcloud tasks delete operation typically these are written to a http.Request +/* PcloudTasksDeleteParams contains all the parameters to send to the API endpoint + for the pcloud tasks delete operation. + + Typically these are written to a http.Request. */ type PcloudTasksDeleteParams struct { - /*TaskID - PCloud Task ID + /* TaskID. + PCloud Task ID */ TaskID string @@ -72,6 +70,21 @@ type PcloudTasksDeleteParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud tasks delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTasksDeleteParams) WithDefaults() *PcloudTasksDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud tasks delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTasksDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud tasks delete params func (o *PcloudTasksDeleteParams) WithTimeout(timeout time.Duration) *PcloudTasksDeleteParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_tasks/pcloud_tasks_delete_responses.go b/power/client/p_cloud_tasks/pcloud_tasks_delete_responses.go index d739a07e..63e82c88 100644 --- a/power/client/p_cloud_tasks/pcloud_tasks_delete_responses.go +++ b/power/client/p_cloud_tasks/pcloud_tasks_delete_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudTasksDeleteReader is a Reader for the PcloudTasksDelete structure. @@ -24,51 +23,44 @@ type PcloudTasksDeleteReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudTasksDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudTasksDeleteOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudTasksDeleteBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudTasksDeleteUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudTasksDeleteNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 410: result := NewPcloudTasksDeleteGone() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudTasksDeleteInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -77,7 +69,7 @@ func NewPcloudTasksDeleteOK() *PcloudTasksDeleteOK { return &PcloudTasksDeleteOK{} } -/*PcloudTasksDeleteOK handles this case with default header values. +/* PcloudTasksDeleteOK describes a response with status code 200, with default header values. OK */ @@ -88,6 +80,9 @@ type PcloudTasksDeleteOK struct { func (o *PcloudTasksDeleteOK) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/tasks/{task_id}][%d] pcloudTasksDeleteOK %+v", 200, o.Payload) } +func (o *PcloudTasksDeleteOK) GetPayload() models.Object { + return o.Payload +} func (o *PcloudTasksDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -104,7 +99,7 @@ func NewPcloudTasksDeleteBadRequest() *PcloudTasksDeleteBadRequest { return &PcloudTasksDeleteBadRequest{} } -/*PcloudTasksDeleteBadRequest handles this case with default header values. +/* PcloudTasksDeleteBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -115,6 +110,9 @@ type PcloudTasksDeleteBadRequest struct { func (o *PcloudTasksDeleteBadRequest) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/tasks/{task_id}][%d] pcloudTasksDeleteBadRequest %+v", 400, o.Payload) } +func (o *PcloudTasksDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTasksDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -133,7 +131,7 @@ func NewPcloudTasksDeleteUnauthorized() *PcloudTasksDeleteUnauthorized { return &PcloudTasksDeleteUnauthorized{} } -/*PcloudTasksDeleteUnauthorized handles this case with default header values. +/* PcloudTasksDeleteUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -144,6 +142,9 @@ type PcloudTasksDeleteUnauthorized struct { func (o *PcloudTasksDeleteUnauthorized) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/tasks/{task_id}][%d] pcloudTasksDeleteUnauthorized %+v", 401, o.Payload) } +func (o *PcloudTasksDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTasksDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -162,7 +163,7 @@ func NewPcloudTasksDeleteNotFound() *PcloudTasksDeleteNotFound { return &PcloudTasksDeleteNotFound{} } -/*PcloudTasksDeleteNotFound handles this case with default header values. +/* PcloudTasksDeleteNotFound describes a response with status code 404, with default header values. Not Found */ @@ -173,6 +174,9 @@ type PcloudTasksDeleteNotFound struct { func (o *PcloudTasksDeleteNotFound) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/tasks/{task_id}][%d] pcloudTasksDeleteNotFound %+v", 404, o.Payload) } +func (o *PcloudTasksDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTasksDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -191,7 +195,7 @@ func NewPcloudTasksDeleteGone() *PcloudTasksDeleteGone { return &PcloudTasksDeleteGone{} } -/*PcloudTasksDeleteGone handles this case with default header values. +/* PcloudTasksDeleteGone describes a response with status code 410, with default header values. Gone */ @@ -202,6 +206,9 @@ type PcloudTasksDeleteGone struct { func (o *PcloudTasksDeleteGone) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/tasks/{task_id}][%d] pcloudTasksDeleteGone %+v", 410, o.Payload) } +func (o *PcloudTasksDeleteGone) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTasksDeleteGone) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -220,7 +227,7 @@ func NewPcloudTasksDeleteInternalServerError() *PcloudTasksDeleteInternalServerE return &PcloudTasksDeleteInternalServerError{} } -/*PcloudTasksDeleteInternalServerError handles this case with default header values. +/* PcloudTasksDeleteInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -231,6 +238,9 @@ type PcloudTasksDeleteInternalServerError struct { func (o *PcloudTasksDeleteInternalServerError) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/tasks/{task_id}][%d] pcloudTasksDeleteInternalServerError %+v", 500, o.Payload) } +func (o *PcloudTasksDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTasksDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_tasks/pcloud_tasks_get_parameters.go b/power/client/p_cloud_tasks/pcloud_tasks_get_parameters.go index 23eee0bb..756ff392 100644 --- a/power/client/p_cloud_tasks/pcloud_tasks_get_parameters.go +++ b/power/client/p_cloud_tasks/pcloud_tasks_get_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudTasksGetParams creates a new PcloudTasksGetParams object -// with the default values initialized. +// NewPcloudTasksGetParams creates a new PcloudTasksGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudTasksGetParams() *PcloudTasksGetParams { - var () return &PcloudTasksGetParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudTasksGetParamsWithTimeout creates a new PcloudTasksGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudTasksGetParamsWithTimeout(timeout time.Duration) *PcloudTasksGetParams { - var () return &PcloudTasksGetParams{ - timeout: timeout, } } // NewPcloudTasksGetParamsWithContext creates a new PcloudTasksGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudTasksGetParamsWithContext(ctx context.Context) *PcloudTasksGetParams { - var () return &PcloudTasksGetParams{ - Context: ctx, } } // NewPcloudTasksGetParamsWithHTTPClient creates a new PcloudTasksGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudTasksGetParamsWithHTTPClient(client *http.Client) *PcloudTasksGetParams { - var () return &PcloudTasksGetParams{ HTTPClient: client, } } -/*PcloudTasksGetParams contains all the parameters to send to the API endpoint -for the pcloud tasks get operation typically these are written to a http.Request +/* PcloudTasksGetParams contains all the parameters to send to the API endpoint + for the pcloud tasks get operation. + + Typically these are written to a http.Request. */ type PcloudTasksGetParams struct { - /*TaskID - PCloud Task ID + /* TaskID. + PCloud Task ID */ TaskID string @@ -72,6 +70,21 @@ type PcloudTasksGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud tasks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTasksGetParams) WithDefaults() *PcloudTasksGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud tasks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTasksGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud tasks get params func (o *PcloudTasksGetParams) WithTimeout(timeout time.Duration) *PcloudTasksGetParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_tasks/pcloud_tasks_get_responses.go b/power/client/p_cloud_tasks/pcloud_tasks_get_responses.go index 2315afbb..607e52aa 100644 --- a/power/client/p_cloud_tasks/pcloud_tasks_get_responses.go +++ b/power/client/p_cloud_tasks/pcloud_tasks_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudTasksGetReader is a Reader for the PcloudTasksGet structure. @@ -24,44 +23,38 @@ type PcloudTasksGetReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudTasksGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudTasksGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudTasksGetBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudTasksGetUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudTasksGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudTasksGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudTasksGetOK() *PcloudTasksGetOK { return &PcloudTasksGetOK{} } -/*PcloudTasksGetOK handles this case with default header values. +/* PcloudTasksGetOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudTasksGetOK struct { func (o *PcloudTasksGetOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/tasks/{task_id}][%d] pcloudTasksGetOK %+v", 200, o.Payload) } +func (o *PcloudTasksGetOK) GetPayload() *models.Task { + return o.Payload +} func (o *PcloudTasksGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudTasksGetBadRequest() *PcloudTasksGetBadRequest { return &PcloudTasksGetBadRequest{} } -/*PcloudTasksGetBadRequest handles this case with default header values. +/* PcloudTasksGetBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudTasksGetBadRequest struct { func (o *PcloudTasksGetBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/tasks/{task_id}][%d] pcloudTasksGetBadRequest %+v", 400, o.Payload) } +func (o *PcloudTasksGetBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTasksGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudTasksGetUnauthorized() *PcloudTasksGetUnauthorized { return &PcloudTasksGetUnauthorized{} } -/*PcloudTasksGetUnauthorized handles this case with default header values. +/* PcloudTasksGetUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudTasksGetUnauthorized struct { func (o *PcloudTasksGetUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/tasks/{task_id}][%d] pcloudTasksGetUnauthorized %+v", 401, o.Payload) } +func (o *PcloudTasksGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTasksGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudTasksGetNotFound() *PcloudTasksGetNotFound { return &PcloudTasksGetNotFound{} } -/*PcloudTasksGetNotFound handles this case with default header values. +/* PcloudTasksGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -168,6 +170,9 @@ type PcloudTasksGetNotFound struct { func (o *PcloudTasksGetNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/tasks/{task_id}][%d] pcloudTasksGetNotFound %+v", 404, o.Payload) } +func (o *PcloudTasksGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTasksGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudTasksGetInternalServerError() *PcloudTasksGetInternalServerError { return &PcloudTasksGetInternalServerError{} } -/*PcloudTasksGetInternalServerError handles this case with default header values. +/* PcloudTasksGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudTasksGetInternalServerError struct { func (o *PcloudTasksGetInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/tasks/{task_id}][%d] pcloudTasksGetInternalServerError %+v", 500, o.Payload) } +func (o *PcloudTasksGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTasksGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_tenants/p_cloud_tenants_client.go b/power/client/p_cloud_tenants/p_cloud_tenants_client.go index cdb69dcd..48cd87d9 100644 --- a/power/client/p_cloud_tenants/p_cloud_tenants_client.go +++ b/power/client/p_cloud_tenants/p_cloud_tenants_client.go @@ -6,13 +6,14 @@ package p_cloud_tenants // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/runtime" + "fmt" - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" ) // New creates a new p cloud tenants API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { return &Client{transport: transport, formats: formats} } @@ -24,16 +25,27 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudTenantsGet(params *PcloudTenantsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTenantsGetOK, error) + + PcloudTenantsPut(params *PcloudTenantsPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTenantsPutOK, error) + + SetTransport(transport runtime.ClientTransport) +} + /* -PcloudTenantsGet gets a tenant s current state information + PcloudTenantsGet gets a tenant s current state information */ -func (a *Client) PcloudTenantsGet(params *PcloudTenantsGetParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudTenantsGetOK, error) { +func (a *Client) PcloudTenantsGet(params *PcloudTenantsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTenantsGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudTenantsGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.tenants.get", Method: "GET", PathPattern: "/pcloud/v1/tenants/{tenant_id}", @@ -45,24 +57,34 @@ func (a *Client) PcloudTenantsGet(params *PcloudTenantsGetParams, authInfo runti AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudTenantsGetOK), nil - + success, ok := result.(*PcloudTenantsGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.tenants.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudTenantsPut updates a tenant + PcloudTenantsPut updates a tenant */ -func (a *Client) PcloudTenantsPut(params *PcloudTenantsPutParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudTenantsPutOK, error) { +func (a *Client) PcloudTenantsPut(params *PcloudTenantsPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTenantsPutOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudTenantsPutParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.tenants.put", Method: "PUT", PathPattern: "/pcloud/v1/tenants/{tenant_id}", @@ -74,12 +96,23 @@ func (a *Client) PcloudTenantsPut(params *PcloudTenantsPutParams, authInfo runti AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudTenantsPutOK), nil - + success, ok := result.(*PcloudTenantsPutOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.tenants.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } // SetTransport changes the transport on the client diff --git a/power/client/p_cloud_tenants/pcloud_tenants_get_parameters.go b/power/client/p_cloud_tenants/pcloud_tenants_get_parameters.go index d307eed3..f6106bae 100644 --- a/power/client/p_cloud_tenants/pcloud_tenants_get_parameters.go +++ b/power/client/p_cloud_tenants/pcloud_tenants_get_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudTenantsGetParams creates a new PcloudTenantsGetParams object -// with the default values initialized. +// NewPcloudTenantsGetParams creates a new PcloudTenantsGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudTenantsGetParams() *PcloudTenantsGetParams { - var () return &PcloudTenantsGetParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudTenantsGetParamsWithTimeout creates a new PcloudTenantsGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudTenantsGetParamsWithTimeout(timeout time.Duration) *PcloudTenantsGetParams { - var () return &PcloudTenantsGetParams{ - timeout: timeout, } } // NewPcloudTenantsGetParamsWithContext creates a new PcloudTenantsGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudTenantsGetParamsWithContext(ctx context.Context) *PcloudTenantsGetParams { - var () return &PcloudTenantsGetParams{ - Context: ctx, } } // NewPcloudTenantsGetParamsWithHTTPClient creates a new PcloudTenantsGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudTenantsGetParamsWithHTTPClient(client *http.Client) *PcloudTenantsGetParams { - var () return &PcloudTenantsGetParams{ HTTPClient: client, } } -/*PcloudTenantsGetParams contains all the parameters to send to the API endpoint -for the pcloud tenants get operation typically these are written to a http.Request +/* PcloudTenantsGetParams contains all the parameters to send to the API endpoint + for the pcloud tenants get operation. + + Typically these are written to a http.Request. */ type PcloudTenantsGetParams struct { - /*TenantID - Tenant ID of a pcloud tenant + /* TenantID. + Tenant ID of a pcloud tenant */ TenantID string @@ -72,6 +70,21 @@ type PcloudTenantsGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud tenants get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTenantsGetParams) WithDefaults() *PcloudTenantsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud tenants get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTenantsGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud tenants get params func (o *PcloudTenantsGetParams) WithTimeout(timeout time.Duration) *PcloudTenantsGetParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_tenants/pcloud_tenants_get_responses.go b/power/client/p_cloud_tenants/pcloud_tenants_get_responses.go index 1f6d9202..a6ca2731 100644 --- a/power/client/p_cloud_tenants/pcloud_tenants_get_responses.go +++ b/power/client/p_cloud_tenants/pcloud_tenants_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudTenantsGetReader is a Reader for the PcloudTenantsGet structure. @@ -24,51 +23,44 @@ type PcloudTenantsGetReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudTenantsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudTenantsGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudTenantsGetBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudTenantsGetUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 403: result := NewPcloudTenantsGetForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudTenantsGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudTenantsGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -77,7 +69,7 @@ func NewPcloudTenantsGetOK() *PcloudTenantsGetOK { return &PcloudTenantsGetOK{} } -/*PcloudTenantsGetOK handles this case with default header values. +/* PcloudTenantsGetOK describes a response with status code 200, with default header values. OK */ @@ -88,6 +80,9 @@ type PcloudTenantsGetOK struct { func (o *PcloudTenantsGetOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/tenants/{tenant_id}][%d] pcloudTenantsGetOK %+v", 200, o.Payload) } +func (o *PcloudTenantsGetOK) GetPayload() *models.Tenant { + return o.Payload +} func (o *PcloudTenantsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -106,7 +101,7 @@ func NewPcloudTenantsGetBadRequest() *PcloudTenantsGetBadRequest { return &PcloudTenantsGetBadRequest{} } -/*PcloudTenantsGetBadRequest handles this case with default header values. +/* PcloudTenantsGetBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -117,6 +112,9 @@ type PcloudTenantsGetBadRequest struct { func (o *PcloudTenantsGetBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/tenants/{tenant_id}][%d] pcloudTenantsGetBadRequest %+v", 400, o.Payload) } +func (o *PcloudTenantsGetBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTenantsGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -135,7 +133,7 @@ func NewPcloudTenantsGetUnauthorized() *PcloudTenantsGetUnauthorized { return &PcloudTenantsGetUnauthorized{} } -/*PcloudTenantsGetUnauthorized handles this case with default header values. +/* PcloudTenantsGetUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -146,6 +144,9 @@ type PcloudTenantsGetUnauthorized struct { func (o *PcloudTenantsGetUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/tenants/{tenant_id}][%d] pcloudTenantsGetUnauthorized %+v", 401, o.Payload) } +func (o *PcloudTenantsGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTenantsGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -164,7 +165,7 @@ func NewPcloudTenantsGetForbidden() *PcloudTenantsGetForbidden { return &PcloudTenantsGetForbidden{} } -/*PcloudTenantsGetForbidden handles this case with default header values. +/* PcloudTenantsGetForbidden describes a response with status code 403, with default header values. Forbidden */ @@ -175,6 +176,9 @@ type PcloudTenantsGetForbidden struct { func (o *PcloudTenantsGetForbidden) Error() string { return fmt.Sprintf("[GET /pcloud/v1/tenants/{tenant_id}][%d] pcloudTenantsGetForbidden %+v", 403, o.Payload) } +func (o *PcloudTenantsGetForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTenantsGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -193,7 +197,7 @@ func NewPcloudTenantsGetNotFound() *PcloudTenantsGetNotFound { return &PcloudTenantsGetNotFound{} } -/*PcloudTenantsGetNotFound handles this case with default header values. +/* PcloudTenantsGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -204,6 +208,9 @@ type PcloudTenantsGetNotFound struct { func (o *PcloudTenantsGetNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/tenants/{tenant_id}][%d] pcloudTenantsGetNotFound %+v", 404, o.Payload) } +func (o *PcloudTenantsGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTenantsGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -222,7 +229,7 @@ func NewPcloudTenantsGetInternalServerError() *PcloudTenantsGetInternalServerErr return &PcloudTenantsGetInternalServerError{} } -/*PcloudTenantsGetInternalServerError handles this case with default header values. +/* PcloudTenantsGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -233,6 +240,9 @@ type PcloudTenantsGetInternalServerError struct { func (o *PcloudTenantsGetInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/tenants/{tenant_id}][%d] pcloudTenantsGetInternalServerError %+v", 500, o.Payload) } +func (o *PcloudTenantsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTenantsGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_tenants/pcloud_tenants_put_parameters.go b/power/client/p_cloud_tenants/pcloud_tenants_put_parameters.go index f481bbbc..182262c5 100644 --- a/power/client/p_cloud_tenants/pcloud_tenants_put_parameters.go +++ b/power/client/p_cloud_tenants/pcloud_tenants_put_parameters.go @@ -13,64 +13,63 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudTenantsPutParams creates a new PcloudTenantsPutParams object -// with the default values initialized. +// NewPcloudTenantsPutParams creates a new PcloudTenantsPutParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudTenantsPutParams() *PcloudTenantsPutParams { - var () return &PcloudTenantsPutParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudTenantsPutParamsWithTimeout creates a new PcloudTenantsPutParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudTenantsPutParamsWithTimeout(timeout time.Duration) *PcloudTenantsPutParams { - var () return &PcloudTenantsPutParams{ - timeout: timeout, } } // NewPcloudTenantsPutParamsWithContext creates a new PcloudTenantsPutParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudTenantsPutParamsWithContext(ctx context.Context) *PcloudTenantsPutParams { - var () return &PcloudTenantsPutParams{ - Context: ctx, } } // NewPcloudTenantsPutParamsWithHTTPClient creates a new PcloudTenantsPutParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudTenantsPutParamsWithHTTPClient(client *http.Client) *PcloudTenantsPutParams { - var () return &PcloudTenantsPutParams{ HTTPClient: client, } } -/*PcloudTenantsPutParams contains all the parameters to send to the API endpoint -for the pcloud tenants put operation typically these are written to a http.Request +/* PcloudTenantsPutParams contains all the parameters to send to the API endpoint + for the pcloud tenants put operation. + + Typically these are written to a http.Request. */ type PcloudTenantsPutParams struct { - /*Body - Parameters for updating a Tenant + /* Body. + Parameters for updating a Tenant */ Body *models.TenantUpdate - /*TenantID - Tenant ID of a pcloud tenant + /* TenantID. + + Tenant ID of a pcloud tenant */ TenantID string @@ -79,6 +78,21 @@ type PcloudTenantsPutParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud tenants put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTenantsPutParams) WithDefaults() *PcloudTenantsPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud tenants put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTenantsPutParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud tenants put params func (o *PcloudTenantsPutParams) WithTimeout(timeout time.Duration) *PcloudTenantsPutParams { o.SetTimeout(timeout) @@ -141,7 +155,6 @@ func (o *PcloudTenantsPutParams) WriteToRequest(r runtime.ClientRequest, reg str return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_tenants/pcloud_tenants_put_responses.go b/power/client/p_cloud_tenants/pcloud_tenants_put_responses.go index d81ccd0f..75fec044 100644 --- a/power/client/p_cloud_tenants/pcloud_tenants_put_responses.go +++ b/power/client/p_cloud_tenants/pcloud_tenants_put_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudTenantsPutReader is a Reader for the PcloudTenantsPut structure. @@ -24,44 +23,38 @@ type PcloudTenantsPutReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudTenantsPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudTenantsPutOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudTenantsPutBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudTenantsPutUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudTenantsPutUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudTenantsPutInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudTenantsPutOK() *PcloudTenantsPutOK { return &PcloudTenantsPutOK{} } -/*PcloudTenantsPutOK handles this case with default header values. +/* PcloudTenantsPutOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudTenantsPutOK struct { func (o *PcloudTenantsPutOK) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/tenants/{tenant_id}][%d] pcloudTenantsPutOK %+v", 200, o.Payload) } +func (o *PcloudTenantsPutOK) GetPayload() *models.Tenant { + return o.Payload +} func (o *PcloudTenantsPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudTenantsPutBadRequest() *PcloudTenantsPutBadRequest { return &PcloudTenantsPutBadRequest{} } -/*PcloudTenantsPutBadRequest handles this case with default header values. +/* PcloudTenantsPutBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudTenantsPutBadRequest struct { func (o *PcloudTenantsPutBadRequest) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/tenants/{tenant_id}][%d] pcloudTenantsPutBadRequest %+v", 400, o.Payload) } +func (o *PcloudTenantsPutBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTenantsPutBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudTenantsPutUnauthorized() *PcloudTenantsPutUnauthorized { return &PcloudTenantsPutUnauthorized{} } -/*PcloudTenantsPutUnauthorized handles this case with default header values. +/* PcloudTenantsPutUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudTenantsPutUnauthorized struct { func (o *PcloudTenantsPutUnauthorized) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/tenants/{tenant_id}][%d] pcloudTenantsPutUnauthorized %+v", 401, o.Payload) } +func (o *PcloudTenantsPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTenantsPutUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudTenantsPutUnprocessableEntity() *PcloudTenantsPutUnprocessableEnti return &PcloudTenantsPutUnprocessableEntity{} } -/*PcloudTenantsPutUnprocessableEntity handles this case with default header values. +/* PcloudTenantsPutUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -168,6 +170,9 @@ type PcloudTenantsPutUnprocessableEntity struct { func (o *PcloudTenantsPutUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/tenants/{tenant_id}][%d] pcloudTenantsPutUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudTenantsPutUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTenantsPutUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudTenantsPutInternalServerError() *PcloudTenantsPutInternalServerErr return &PcloudTenantsPutInternalServerError{} } -/*PcloudTenantsPutInternalServerError handles this case with default header values. +/* PcloudTenantsPutInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudTenantsPutInternalServerError struct { func (o *PcloudTenantsPutInternalServerError) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/tenants/{tenant_id}][%d] pcloudTenantsPutInternalServerError %+v", 500, o.Payload) } +func (o *PcloudTenantsPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTenantsPutInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_tenants_ssh_keys/p_cloud_tenants_ssh_keys_client.go b/power/client/p_cloud_tenants_ssh_keys/p_cloud_tenants_ssh_keys_client.go index 4f74cbbe..d05737fe 100644 --- a/power/client/p_cloud_tenants_ssh_keys/p_cloud_tenants_ssh_keys_client.go +++ b/power/client/p_cloud_tenants_ssh_keys/p_cloud_tenants_ssh_keys_client.go @@ -6,13 +6,14 @@ package p_cloud_tenants_ssh_keys // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/runtime" + "fmt" - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" ) // New creates a new p cloud tenants ssh keys API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { return &Client{transport: transport, formats: formats} } @@ -24,16 +25,33 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudTenantsSshkeysDelete(params *PcloudTenantsSshkeysDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTenantsSshkeysDeleteOK, error) + + PcloudTenantsSshkeysGet(params *PcloudTenantsSshkeysGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTenantsSshkeysGetOK, error) + + PcloudTenantsSshkeysGetall(params *PcloudTenantsSshkeysGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTenantsSshkeysGetallOK, error) + + PcloudTenantsSshkeysPost(params *PcloudTenantsSshkeysPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTenantsSshkeysPostOK, *PcloudTenantsSshkeysPostCreated, error) + + PcloudTenantsSshkeysPut(params *PcloudTenantsSshkeysPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTenantsSshkeysPutOK, error) + + SetTransport(transport runtime.ClientTransport) +} + /* -PcloudTenantsSshkeysDelete deletes a tenant s SSH key + PcloudTenantsSshkeysDelete deletes a tenant s SSH key */ -func (a *Client) PcloudTenantsSshkeysDelete(params *PcloudTenantsSshkeysDeleteParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudTenantsSshkeysDeleteOK, error) { +func (a *Client) PcloudTenantsSshkeysDelete(params *PcloudTenantsSshkeysDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTenantsSshkeysDeleteOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudTenantsSshkeysDeleteParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.tenants.sshkeys.delete", Method: "DELETE", PathPattern: "/pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}", @@ -45,24 +63,34 @@ func (a *Client) PcloudTenantsSshkeysDelete(params *PcloudTenantsSshkeysDeletePa AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudTenantsSshkeysDeleteOK), nil - + success, ok := result.(*PcloudTenantsSshkeysDeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.tenants.sshkeys.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudTenantsSshkeysGet gets a tenant s SSH key by name + PcloudTenantsSshkeysGet gets a tenant s SSH key by name */ -func (a *Client) PcloudTenantsSshkeysGet(params *PcloudTenantsSshkeysGetParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudTenantsSshkeysGetOK, error) { +func (a *Client) PcloudTenantsSshkeysGet(params *PcloudTenantsSshkeysGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTenantsSshkeysGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudTenantsSshkeysGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.tenants.sshkeys.get", Method: "GET", PathPattern: "/pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}", @@ -74,24 +102,34 @@ func (a *Client) PcloudTenantsSshkeysGet(params *PcloudTenantsSshkeysGetParams, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudTenantsSshkeysGetOK), nil - + success, ok := result.(*PcloudTenantsSshkeysGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.tenants.sshkeys.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudTenantsSshkeysGetall lists a tenant s SSH keys + PcloudTenantsSshkeysGetall lists a tenant s SSH keys */ -func (a *Client) PcloudTenantsSshkeysGetall(params *PcloudTenantsSshkeysGetallParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudTenantsSshkeysGetallOK, error) { +func (a *Client) PcloudTenantsSshkeysGetall(params *PcloudTenantsSshkeysGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTenantsSshkeysGetallOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudTenantsSshkeysGetallParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.tenants.sshkeys.getall", Method: "GET", PathPattern: "/pcloud/v1/tenants/{tenant_id}/sshkeys", @@ -103,24 +141,34 @@ func (a *Client) PcloudTenantsSshkeysGetall(params *PcloudTenantsSshkeysGetallPa AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudTenantsSshkeysGetallOK), nil - + success, ok := result.(*PcloudTenantsSshkeysGetallOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.tenants.sshkeys.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudTenantsSshkeysPost adds a new SSH key to the tenant + PcloudTenantsSshkeysPost adds a new SSH key to the tenant */ -func (a *Client) PcloudTenantsSshkeysPost(params *PcloudTenantsSshkeysPostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudTenantsSshkeysPostOK, *PcloudTenantsSshkeysPostCreated, error) { +func (a *Client) PcloudTenantsSshkeysPost(params *PcloudTenantsSshkeysPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTenantsSshkeysPostOK, *PcloudTenantsSshkeysPostCreated, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudTenantsSshkeysPostParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.tenants.sshkeys.post", Method: "POST", PathPattern: "/pcloud/v1/tenants/{tenant_id}/sshkeys", @@ -132,7 +180,12 @@ func (a *Client) PcloudTenantsSshkeysPost(params *PcloudTenantsSshkeysPostParams AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, nil, err } @@ -142,20 +195,20 @@ func (a *Client) PcloudTenantsSshkeysPost(params *PcloudTenantsSshkeysPostParams case *PcloudTenantsSshkeysPostCreated: return nil, value, nil } - return nil, nil, nil - + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for p_cloud_tenants_ssh_keys: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudTenantsSshkeysPut updates an SSH key + PcloudTenantsSshkeysPut updates an SSH key */ -func (a *Client) PcloudTenantsSshkeysPut(params *PcloudTenantsSshkeysPutParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudTenantsSshkeysPutOK, error) { +func (a *Client) PcloudTenantsSshkeysPut(params *PcloudTenantsSshkeysPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTenantsSshkeysPutOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudTenantsSshkeysPutParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.tenants.sshkeys.put", Method: "PUT", PathPattern: "/pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}", @@ -167,12 +220,23 @@ func (a *Client) PcloudTenantsSshkeysPut(params *PcloudTenantsSshkeysPutParams, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudTenantsSshkeysPutOK), nil - + success, ok := result.(*PcloudTenantsSshkeysPutOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.tenants.sshkeys.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } // SetTransport changes the transport on the client diff --git a/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_delete_parameters.go b/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_delete_parameters.go index dce57f38..0de6c32d 100644 --- a/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_delete_parameters.go +++ b/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_delete_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudTenantsSshkeysDeleteParams creates a new PcloudTenantsSshkeysDeleteParams object -// with the default values initialized. +// NewPcloudTenantsSshkeysDeleteParams creates a new PcloudTenantsSshkeysDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudTenantsSshkeysDeleteParams() *PcloudTenantsSshkeysDeleteParams { - var () return &PcloudTenantsSshkeysDeleteParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudTenantsSshkeysDeleteParamsWithTimeout creates a new PcloudTenantsSshkeysDeleteParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudTenantsSshkeysDeleteParamsWithTimeout(timeout time.Duration) *PcloudTenantsSshkeysDeleteParams { - var () return &PcloudTenantsSshkeysDeleteParams{ - timeout: timeout, } } // NewPcloudTenantsSshkeysDeleteParamsWithContext creates a new PcloudTenantsSshkeysDeleteParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudTenantsSshkeysDeleteParamsWithContext(ctx context.Context) *PcloudTenantsSshkeysDeleteParams { - var () return &PcloudTenantsSshkeysDeleteParams{ - Context: ctx, } } // NewPcloudTenantsSshkeysDeleteParamsWithHTTPClient creates a new PcloudTenantsSshkeysDeleteParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudTenantsSshkeysDeleteParamsWithHTTPClient(client *http.Client) *PcloudTenantsSshkeysDeleteParams { - var () return &PcloudTenantsSshkeysDeleteParams{ HTTPClient: client, } } -/*PcloudTenantsSshkeysDeleteParams contains all the parameters to send to the API endpoint -for the pcloud tenants sshkeys delete operation typically these are written to a http.Request +/* PcloudTenantsSshkeysDeleteParams contains all the parameters to send to the API endpoint + for the pcloud tenants sshkeys delete operation. + + Typically these are written to a http.Request. */ type PcloudTenantsSshkeysDeleteParams struct { - /*SshkeyName - SSH key name for a pcloud tenant + /* SshkeyName. + SSH key name for a pcloud tenant */ SshkeyName string - /*TenantID - Tenant ID of a pcloud tenant + /* TenantID. + + Tenant ID of a pcloud tenant */ TenantID string @@ -77,6 +76,21 @@ type PcloudTenantsSshkeysDeleteParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud tenants sshkeys delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTenantsSshkeysDeleteParams) WithDefaults() *PcloudTenantsSshkeysDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud tenants sshkeys delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTenantsSshkeysDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud tenants sshkeys delete params func (o *PcloudTenantsSshkeysDeleteParams) WithTimeout(timeout time.Duration) *PcloudTenantsSshkeysDeleteParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_delete_responses.go b/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_delete_responses.go index fd350dd9..2c0f8aa2 100644 --- a/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_delete_responses.go +++ b/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_delete_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudTenantsSshkeysDeleteReader is a Reader for the PcloudTenantsSshkeysDelete structure. @@ -24,44 +23,38 @@ type PcloudTenantsSshkeysDeleteReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudTenantsSshkeysDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudTenantsSshkeysDeleteOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudTenantsSshkeysDeleteBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudTenantsSshkeysDeleteUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 410: result := NewPcloudTenantsSshkeysDeleteGone() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudTenantsSshkeysDeleteInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudTenantsSshkeysDeleteOK() *PcloudTenantsSshkeysDeleteOK { return &PcloudTenantsSshkeysDeleteOK{} } -/*PcloudTenantsSshkeysDeleteOK handles this case with default header values. +/* PcloudTenantsSshkeysDeleteOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudTenantsSshkeysDeleteOK struct { func (o *PcloudTenantsSshkeysDeleteOK) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}][%d] pcloudTenantsSshkeysDeleteOK %+v", 200, o.Payload) } +func (o *PcloudTenantsSshkeysDeleteOK) GetPayload() models.Object { + return o.Payload +} func (o *PcloudTenantsSshkeysDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -97,7 +93,7 @@ func NewPcloudTenantsSshkeysDeleteBadRequest() *PcloudTenantsSshkeysDeleteBadReq return &PcloudTenantsSshkeysDeleteBadRequest{} } -/*PcloudTenantsSshkeysDeleteBadRequest handles this case with default header values. +/* PcloudTenantsSshkeysDeleteBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -108,6 +104,9 @@ type PcloudTenantsSshkeysDeleteBadRequest struct { func (o *PcloudTenantsSshkeysDeleteBadRequest) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}][%d] pcloudTenantsSshkeysDeleteBadRequest %+v", 400, o.Payload) } +func (o *PcloudTenantsSshkeysDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTenantsSshkeysDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -126,7 +125,7 @@ func NewPcloudTenantsSshkeysDeleteUnauthorized() *PcloudTenantsSshkeysDeleteUnau return &PcloudTenantsSshkeysDeleteUnauthorized{} } -/*PcloudTenantsSshkeysDeleteUnauthorized handles this case with default header values. +/* PcloudTenantsSshkeysDeleteUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -137,6 +136,9 @@ type PcloudTenantsSshkeysDeleteUnauthorized struct { func (o *PcloudTenantsSshkeysDeleteUnauthorized) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}][%d] pcloudTenantsSshkeysDeleteUnauthorized %+v", 401, o.Payload) } +func (o *PcloudTenantsSshkeysDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTenantsSshkeysDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -155,7 +157,7 @@ func NewPcloudTenantsSshkeysDeleteGone() *PcloudTenantsSshkeysDeleteGone { return &PcloudTenantsSshkeysDeleteGone{} } -/*PcloudTenantsSshkeysDeleteGone handles this case with default header values. +/* PcloudTenantsSshkeysDeleteGone describes a response with status code 410, with default header values. Gone */ @@ -166,6 +168,9 @@ type PcloudTenantsSshkeysDeleteGone struct { func (o *PcloudTenantsSshkeysDeleteGone) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}][%d] pcloudTenantsSshkeysDeleteGone %+v", 410, o.Payload) } +func (o *PcloudTenantsSshkeysDeleteGone) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTenantsSshkeysDeleteGone) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -184,7 +189,7 @@ func NewPcloudTenantsSshkeysDeleteInternalServerError() *PcloudTenantsSshkeysDel return &PcloudTenantsSshkeysDeleteInternalServerError{} } -/*PcloudTenantsSshkeysDeleteInternalServerError handles this case with default header values. +/* PcloudTenantsSshkeysDeleteInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -195,6 +200,9 @@ type PcloudTenantsSshkeysDeleteInternalServerError struct { func (o *PcloudTenantsSshkeysDeleteInternalServerError) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}][%d] pcloudTenantsSshkeysDeleteInternalServerError %+v", 500, o.Payload) } +func (o *PcloudTenantsSshkeysDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTenantsSshkeysDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_get_parameters.go b/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_get_parameters.go index 052ac742..574cc6ae 100644 --- a/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_get_parameters.go +++ b/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_get_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudTenantsSshkeysGetParams creates a new PcloudTenantsSshkeysGetParams object -// with the default values initialized. +// NewPcloudTenantsSshkeysGetParams creates a new PcloudTenantsSshkeysGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudTenantsSshkeysGetParams() *PcloudTenantsSshkeysGetParams { - var () return &PcloudTenantsSshkeysGetParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudTenantsSshkeysGetParamsWithTimeout creates a new PcloudTenantsSshkeysGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudTenantsSshkeysGetParamsWithTimeout(timeout time.Duration) *PcloudTenantsSshkeysGetParams { - var () return &PcloudTenantsSshkeysGetParams{ - timeout: timeout, } } // NewPcloudTenantsSshkeysGetParamsWithContext creates a new PcloudTenantsSshkeysGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudTenantsSshkeysGetParamsWithContext(ctx context.Context) *PcloudTenantsSshkeysGetParams { - var () return &PcloudTenantsSshkeysGetParams{ - Context: ctx, } } // NewPcloudTenantsSshkeysGetParamsWithHTTPClient creates a new PcloudTenantsSshkeysGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudTenantsSshkeysGetParamsWithHTTPClient(client *http.Client) *PcloudTenantsSshkeysGetParams { - var () return &PcloudTenantsSshkeysGetParams{ HTTPClient: client, } } -/*PcloudTenantsSshkeysGetParams contains all the parameters to send to the API endpoint -for the pcloud tenants sshkeys get operation typically these are written to a http.Request +/* PcloudTenantsSshkeysGetParams contains all the parameters to send to the API endpoint + for the pcloud tenants sshkeys get operation. + + Typically these are written to a http.Request. */ type PcloudTenantsSshkeysGetParams struct { - /*SshkeyName - SSH key name for a pcloud tenant + /* SshkeyName. + SSH key name for a pcloud tenant */ SshkeyName string - /*TenantID - Tenant ID of a pcloud tenant + /* TenantID. + + Tenant ID of a pcloud tenant */ TenantID string @@ -77,6 +76,21 @@ type PcloudTenantsSshkeysGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud tenants sshkeys get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTenantsSshkeysGetParams) WithDefaults() *PcloudTenantsSshkeysGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud tenants sshkeys get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTenantsSshkeysGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud tenants sshkeys get params func (o *PcloudTenantsSshkeysGetParams) WithTimeout(timeout time.Duration) *PcloudTenantsSshkeysGetParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_get_responses.go b/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_get_responses.go index bc40960e..f49bad3c 100644 --- a/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_get_responses.go +++ b/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudTenantsSshkeysGetReader is a Reader for the PcloudTenantsSshkeysGet structure. @@ -24,44 +23,38 @@ type PcloudTenantsSshkeysGetReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudTenantsSshkeysGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudTenantsSshkeysGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudTenantsSshkeysGetBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudTenantsSshkeysGetUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudTenantsSshkeysGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudTenantsSshkeysGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudTenantsSshkeysGetOK() *PcloudTenantsSshkeysGetOK { return &PcloudTenantsSshkeysGetOK{} } -/*PcloudTenantsSshkeysGetOK handles this case with default header values. +/* PcloudTenantsSshkeysGetOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudTenantsSshkeysGetOK struct { func (o *PcloudTenantsSshkeysGetOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}][%d] pcloudTenantsSshkeysGetOK %+v", 200, o.Payload) } +func (o *PcloudTenantsSshkeysGetOK) GetPayload() *models.SSHKey { + return o.Payload +} func (o *PcloudTenantsSshkeysGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudTenantsSshkeysGetBadRequest() *PcloudTenantsSshkeysGetBadRequest { return &PcloudTenantsSshkeysGetBadRequest{} } -/*PcloudTenantsSshkeysGetBadRequest handles this case with default header values. +/* PcloudTenantsSshkeysGetBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudTenantsSshkeysGetBadRequest struct { func (o *PcloudTenantsSshkeysGetBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}][%d] pcloudTenantsSshkeysGetBadRequest %+v", 400, o.Payload) } +func (o *PcloudTenantsSshkeysGetBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTenantsSshkeysGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudTenantsSshkeysGetUnauthorized() *PcloudTenantsSshkeysGetUnauthoriz return &PcloudTenantsSshkeysGetUnauthorized{} } -/*PcloudTenantsSshkeysGetUnauthorized handles this case with default header values. +/* PcloudTenantsSshkeysGetUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudTenantsSshkeysGetUnauthorized struct { func (o *PcloudTenantsSshkeysGetUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}][%d] pcloudTenantsSshkeysGetUnauthorized %+v", 401, o.Payload) } +func (o *PcloudTenantsSshkeysGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTenantsSshkeysGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudTenantsSshkeysGetNotFound() *PcloudTenantsSshkeysGetNotFound { return &PcloudTenantsSshkeysGetNotFound{} } -/*PcloudTenantsSshkeysGetNotFound handles this case with default header values. +/* PcloudTenantsSshkeysGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -168,6 +170,9 @@ type PcloudTenantsSshkeysGetNotFound struct { func (o *PcloudTenantsSshkeysGetNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}][%d] pcloudTenantsSshkeysGetNotFound %+v", 404, o.Payload) } +func (o *PcloudTenantsSshkeysGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTenantsSshkeysGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudTenantsSshkeysGetInternalServerError() *PcloudTenantsSshkeysGetInt return &PcloudTenantsSshkeysGetInternalServerError{} } -/*PcloudTenantsSshkeysGetInternalServerError handles this case with default header values. +/* PcloudTenantsSshkeysGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudTenantsSshkeysGetInternalServerError struct { func (o *PcloudTenantsSshkeysGetInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}][%d] pcloudTenantsSshkeysGetInternalServerError %+v", 500, o.Payload) } +func (o *PcloudTenantsSshkeysGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTenantsSshkeysGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_getall_parameters.go b/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_getall_parameters.go index 66bbb51f..0e0e30b0 100644 --- a/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_getall_parameters.go +++ b/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_getall_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudTenantsSshkeysGetallParams creates a new PcloudTenantsSshkeysGetallParams object -// with the default values initialized. +// NewPcloudTenantsSshkeysGetallParams creates a new PcloudTenantsSshkeysGetallParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudTenantsSshkeysGetallParams() *PcloudTenantsSshkeysGetallParams { - var () return &PcloudTenantsSshkeysGetallParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudTenantsSshkeysGetallParamsWithTimeout creates a new PcloudTenantsSshkeysGetallParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudTenantsSshkeysGetallParamsWithTimeout(timeout time.Duration) *PcloudTenantsSshkeysGetallParams { - var () return &PcloudTenantsSshkeysGetallParams{ - timeout: timeout, } } // NewPcloudTenantsSshkeysGetallParamsWithContext creates a new PcloudTenantsSshkeysGetallParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudTenantsSshkeysGetallParamsWithContext(ctx context.Context) *PcloudTenantsSshkeysGetallParams { - var () return &PcloudTenantsSshkeysGetallParams{ - Context: ctx, } } // NewPcloudTenantsSshkeysGetallParamsWithHTTPClient creates a new PcloudTenantsSshkeysGetallParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudTenantsSshkeysGetallParamsWithHTTPClient(client *http.Client) *PcloudTenantsSshkeysGetallParams { - var () return &PcloudTenantsSshkeysGetallParams{ HTTPClient: client, } } -/*PcloudTenantsSshkeysGetallParams contains all the parameters to send to the API endpoint -for the pcloud tenants sshkeys getall operation typically these are written to a http.Request +/* PcloudTenantsSshkeysGetallParams contains all the parameters to send to the API endpoint + for the pcloud tenants sshkeys getall operation. + + Typically these are written to a http.Request. */ type PcloudTenantsSshkeysGetallParams struct { - /*TenantID - Tenant ID of a pcloud tenant + /* TenantID. + Tenant ID of a pcloud tenant */ TenantID string @@ -72,6 +70,21 @@ type PcloudTenantsSshkeysGetallParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud tenants sshkeys getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTenantsSshkeysGetallParams) WithDefaults() *PcloudTenantsSshkeysGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud tenants sshkeys getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTenantsSshkeysGetallParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud tenants sshkeys getall params func (o *PcloudTenantsSshkeysGetallParams) WithTimeout(timeout time.Duration) *PcloudTenantsSshkeysGetallParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_getall_responses.go b/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_getall_responses.go index 0405bfdb..700ea0eb 100644 --- a/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_getall_responses.go +++ b/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_getall_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudTenantsSshkeysGetallReader is a Reader for the PcloudTenantsSshkeysGetall structure. @@ -24,44 +23,38 @@ type PcloudTenantsSshkeysGetallReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudTenantsSshkeysGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudTenantsSshkeysGetallOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudTenantsSshkeysGetallBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudTenantsSshkeysGetallUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudTenantsSshkeysGetallNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudTenantsSshkeysGetallInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudTenantsSshkeysGetallOK() *PcloudTenantsSshkeysGetallOK { return &PcloudTenantsSshkeysGetallOK{} } -/*PcloudTenantsSshkeysGetallOK handles this case with default header values. +/* PcloudTenantsSshkeysGetallOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudTenantsSshkeysGetallOK struct { func (o *PcloudTenantsSshkeysGetallOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/tenants/{tenant_id}/sshkeys][%d] pcloudTenantsSshkeysGetallOK %+v", 200, o.Payload) } +func (o *PcloudTenantsSshkeysGetallOK) GetPayload() *models.SSHKeys { + return o.Payload +} func (o *PcloudTenantsSshkeysGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudTenantsSshkeysGetallBadRequest() *PcloudTenantsSshkeysGetallBadReq return &PcloudTenantsSshkeysGetallBadRequest{} } -/*PcloudTenantsSshkeysGetallBadRequest handles this case with default header values. +/* PcloudTenantsSshkeysGetallBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudTenantsSshkeysGetallBadRequest struct { func (o *PcloudTenantsSshkeysGetallBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/tenants/{tenant_id}/sshkeys][%d] pcloudTenantsSshkeysGetallBadRequest %+v", 400, o.Payload) } +func (o *PcloudTenantsSshkeysGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTenantsSshkeysGetallBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudTenantsSshkeysGetallUnauthorized() *PcloudTenantsSshkeysGetallUnau return &PcloudTenantsSshkeysGetallUnauthorized{} } -/*PcloudTenantsSshkeysGetallUnauthorized handles this case with default header values. +/* PcloudTenantsSshkeysGetallUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudTenantsSshkeysGetallUnauthorized struct { func (o *PcloudTenantsSshkeysGetallUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/tenants/{tenant_id}/sshkeys][%d] pcloudTenantsSshkeysGetallUnauthorized %+v", 401, o.Payload) } +func (o *PcloudTenantsSshkeysGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTenantsSshkeysGetallUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudTenantsSshkeysGetallNotFound() *PcloudTenantsSshkeysGetallNotFound return &PcloudTenantsSshkeysGetallNotFound{} } -/*PcloudTenantsSshkeysGetallNotFound handles this case with default header values. +/* PcloudTenantsSshkeysGetallNotFound describes a response with status code 404, with default header values. Not Found */ @@ -168,6 +170,9 @@ type PcloudTenantsSshkeysGetallNotFound struct { func (o *PcloudTenantsSshkeysGetallNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/tenants/{tenant_id}/sshkeys][%d] pcloudTenantsSshkeysGetallNotFound %+v", 404, o.Payload) } +func (o *PcloudTenantsSshkeysGetallNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTenantsSshkeysGetallNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudTenantsSshkeysGetallInternalServerError() *PcloudTenantsSshkeysGet return &PcloudTenantsSshkeysGetallInternalServerError{} } -/*PcloudTenantsSshkeysGetallInternalServerError handles this case with default header values. +/* PcloudTenantsSshkeysGetallInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudTenantsSshkeysGetallInternalServerError struct { func (o *PcloudTenantsSshkeysGetallInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/tenants/{tenant_id}/sshkeys][%d] pcloudTenantsSshkeysGetallInternalServerError %+v", 500, o.Payload) } +func (o *PcloudTenantsSshkeysGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTenantsSshkeysGetallInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_post_parameters.go b/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_post_parameters.go index cdc23262..0f65423a 100644 --- a/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_post_parameters.go +++ b/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_post_parameters.go @@ -13,64 +13,63 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudTenantsSshkeysPostParams creates a new PcloudTenantsSshkeysPostParams object -// with the default values initialized. +// NewPcloudTenantsSshkeysPostParams creates a new PcloudTenantsSshkeysPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudTenantsSshkeysPostParams() *PcloudTenantsSshkeysPostParams { - var () return &PcloudTenantsSshkeysPostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudTenantsSshkeysPostParamsWithTimeout creates a new PcloudTenantsSshkeysPostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudTenantsSshkeysPostParamsWithTimeout(timeout time.Duration) *PcloudTenantsSshkeysPostParams { - var () return &PcloudTenantsSshkeysPostParams{ - timeout: timeout, } } // NewPcloudTenantsSshkeysPostParamsWithContext creates a new PcloudTenantsSshkeysPostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudTenantsSshkeysPostParamsWithContext(ctx context.Context) *PcloudTenantsSshkeysPostParams { - var () return &PcloudTenantsSshkeysPostParams{ - Context: ctx, } } // NewPcloudTenantsSshkeysPostParamsWithHTTPClient creates a new PcloudTenantsSshkeysPostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudTenantsSshkeysPostParamsWithHTTPClient(client *http.Client) *PcloudTenantsSshkeysPostParams { - var () return &PcloudTenantsSshkeysPostParams{ HTTPClient: client, } } -/*PcloudTenantsSshkeysPostParams contains all the parameters to send to the API endpoint -for the pcloud tenants sshkeys post operation typically these are written to a http.Request +/* PcloudTenantsSshkeysPostParams contains all the parameters to send to the API endpoint + for the pcloud tenants sshkeys post operation. + + Typically these are written to a http.Request. */ type PcloudTenantsSshkeysPostParams struct { - /*Body - Parameters for the creation of a new SSH key + /* Body. + Parameters for the creation of a new SSH key */ Body *models.SSHKey - /*TenantID - Tenant ID of a pcloud tenant + /* TenantID. + + Tenant ID of a pcloud tenant */ TenantID string @@ -79,6 +78,21 @@ type PcloudTenantsSshkeysPostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud tenants sshkeys post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTenantsSshkeysPostParams) WithDefaults() *PcloudTenantsSshkeysPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud tenants sshkeys post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTenantsSshkeysPostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud tenants sshkeys post params func (o *PcloudTenantsSshkeysPostParams) WithTimeout(timeout time.Duration) *PcloudTenantsSshkeysPostParams { o.SetTimeout(timeout) @@ -141,7 +155,6 @@ func (o *PcloudTenantsSshkeysPostParams) WriteToRequest(r runtime.ClientRequest, return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_post_responses.go b/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_post_responses.go index 53e307eb..2717b7ea 100644 --- a/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_post_responses.go +++ b/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudTenantsSshkeysPostReader is a Reader for the PcloudTenantsSshkeysPost structure. @@ -24,58 +23,50 @@ type PcloudTenantsSshkeysPostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudTenantsSshkeysPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudTenantsSshkeysPostOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 201: result := NewPcloudTenantsSshkeysPostCreated() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudTenantsSshkeysPostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudTenantsSshkeysPostUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 409: result := NewPcloudTenantsSshkeysPostConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudTenantsSshkeysPostUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudTenantsSshkeysPostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -84,7 +75,7 @@ func NewPcloudTenantsSshkeysPostOK() *PcloudTenantsSshkeysPostOK { return &PcloudTenantsSshkeysPostOK{} } -/*PcloudTenantsSshkeysPostOK handles this case with default header values. +/* PcloudTenantsSshkeysPostOK describes a response with status code 200, with default header values. OK */ @@ -95,6 +86,9 @@ type PcloudTenantsSshkeysPostOK struct { func (o *PcloudTenantsSshkeysPostOK) Error() string { return fmt.Sprintf("[POST /pcloud/v1/tenants/{tenant_id}/sshkeys][%d] pcloudTenantsSshkeysPostOK %+v", 200, o.Payload) } +func (o *PcloudTenantsSshkeysPostOK) GetPayload() *models.SSHKey { + return o.Payload +} func (o *PcloudTenantsSshkeysPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -113,7 +107,7 @@ func NewPcloudTenantsSshkeysPostCreated() *PcloudTenantsSshkeysPostCreated { return &PcloudTenantsSshkeysPostCreated{} } -/*PcloudTenantsSshkeysPostCreated handles this case with default header values. +/* PcloudTenantsSshkeysPostCreated describes a response with status code 201, with default header values. Created */ @@ -124,6 +118,9 @@ type PcloudTenantsSshkeysPostCreated struct { func (o *PcloudTenantsSshkeysPostCreated) Error() string { return fmt.Sprintf("[POST /pcloud/v1/tenants/{tenant_id}/sshkeys][%d] pcloudTenantsSshkeysPostCreated %+v", 201, o.Payload) } +func (o *PcloudTenantsSshkeysPostCreated) GetPayload() *models.SSHKey { + return o.Payload +} func (o *PcloudTenantsSshkeysPostCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -142,7 +139,7 @@ func NewPcloudTenantsSshkeysPostBadRequest() *PcloudTenantsSshkeysPostBadRequest return &PcloudTenantsSshkeysPostBadRequest{} } -/*PcloudTenantsSshkeysPostBadRequest handles this case with default header values. +/* PcloudTenantsSshkeysPostBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -153,6 +150,9 @@ type PcloudTenantsSshkeysPostBadRequest struct { func (o *PcloudTenantsSshkeysPostBadRequest) Error() string { return fmt.Sprintf("[POST /pcloud/v1/tenants/{tenant_id}/sshkeys][%d] pcloudTenantsSshkeysPostBadRequest %+v", 400, o.Payload) } +func (o *PcloudTenantsSshkeysPostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTenantsSshkeysPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -171,7 +171,7 @@ func NewPcloudTenantsSshkeysPostUnauthorized() *PcloudTenantsSshkeysPostUnauthor return &PcloudTenantsSshkeysPostUnauthorized{} } -/*PcloudTenantsSshkeysPostUnauthorized handles this case with default header values. +/* PcloudTenantsSshkeysPostUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -182,6 +182,9 @@ type PcloudTenantsSshkeysPostUnauthorized struct { func (o *PcloudTenantsSshkeysPostUnauthorized) Error() string { return fmt.Sprintf("[POST /pcloud/v1/tenants/{tenant_id}/sshkeys][%d] pcloudTenantsSshkeysPostUnauthorized %+v", 401, o.Payload) } +func (o *PcloudTenantsSshkeysPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTenantsSshkeysPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -200,7 +203,7 @@ func NewPcloudTenantsSshkeysPostConflict() *PcloudTenantsSshkeysPostConflict { return &PcloudTenantsSshkeysPostConflict{} } -/*PcloudTenantsSshkeysPostConflict handles this case with default header values. +/* PcloudTenantsSshkeysPostConflict describes a response with status code 409, with default header values. Conflict */ @@ -211,6 +214,9 @@ type PcloudTenantsSshkeysPostConflict struct { func (o *PcloudTenantsSshkeysPostConflict) Error() string { return fmt.Sprintf("[POST /pcloud/v1/tenants/{tenant_id}/sshkeys][%d] pcloudTenantsSshkeysPostConflict %+v", 409, o.Payload) } +func (o *PcloudTenantsSshkeysPostConflict) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTenantsSshkeysPostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -229,7 +235,7 @@ func NewPcloudTenantsSshkeysPostUnprocessableEntity() *PcloudTenantsSshkeysPostU return &PcloudTenantsSshkeysPostUnprocessableEntity{} } -/*PcloudTenantsSshkeysPostUnprocessableEntity handles this case with default header values. +/* PcloudTenantsSshkeysPostUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -240,6 +246,9 @@ type PcloudTenantsSshkeysPostUnprocessableEntity struct { func (o *PcloudTenantsSshkeysPostUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /pcloud/v1/tenants/{tenant_id}/sshkeys][%d] pcloudTenantsSshkeysPostUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudTenantsSshkeysPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTenantsSshkeysPostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -258,7 +267,7 @@ func NewPcloudTenantsSshkeysPostInternalServerError() *PcloudTenantsSshkeysPostI return &PcloudTenantsSshkeysPostInternalServerError{} } -/*PcloudTenantsSshkeysPostInternalServerError handles this case with default header values. +/* PcloudTenantsSshkeysPostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -269,6 +278,9 @@ type PcloudTenantsSshkeysPostInternalServerError struct { func (o *PcloudTenantsSshkeysPostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v1/tenants/{tenant_id}/sshkeys][%d] pcloudTenantsSshkeysPostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudTenantsSshkeysPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTenantsSshkeysPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_put_parameters.go b/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_put_parameters.go index 79f482c3..af532745 100644 --- a/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_put_parameters.go +++ b/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_put_parameters.go @@ -13,69 +13,69 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudTenantsSshkeysPutParams creates a new PcloudTenantsSshkeysPutParams object -// with the default values initialized. +// NewPcloudTenantsSshkeysPutParams creates a new PcloudTenantsSshkeysPutParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudTenantsSshkeysPutParams() *PcloudTenantsSshkeysPutParams { - var () return &PcloudTenantsSshkeysPutParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudTenantsSshkeysPutParamsWithTimeout creates a new PcloudTenantsSshkeysPutParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudTenantsSshkeysPutParamsWithTimeout(timeout time.Duration) *PcloudTenantsSshkeysPutParams { - var () return &PcloudTenantsSshkeysPutParams{ - timeout: timeout, } } // NewPcloudTenantsSshkeysPutParamsWithContext creates a new PcloudTenantsSshkeysPutParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudTenantsSshkeysPutParamsWithContext(ctx context.Context) *PcloudTenantsSshkeysPutParams { - var () return &PcloudTenantsSshkeysPutParams{ - Context: ctx, } } // NewPcloudTenantsSshkeysPutParamsWithHTTPClient creates a new PcloudTenantsSshkeysPutParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudTenantsSshkeysPutParamsWithHTTPClient(client *http.Client) *PcloudTenantsSshkeysPutParams { - var () return &PcloudTenantsSshkeysPutParams{ HTTPClient: client, } } -/*PcloudTenantsSshkeysPutParams contains all the parameters to send to the API endpoint -for the pcloud tenants sshkeys put operation typically these are written to a http.Request +/* PcloudTenantsSshkeysPutParams contains all the parameters to send to the API endpoint + for the pcloud tenants sshkeys put operation. + + Typically these are written to a http.Request. */ type PcloudTenantsSshkeysPutParams struct { - /*Body - Parameters for updating a Tenant's SSH Key + /* Body. + Parameters for updating a Tenant's SSH Key */ Body *models.SSHKey - /*SshkeyName - SSH key name for a pcloud tenant + /* SshkeyName. + + SSH key name for a pcloud tenant */ SshkeyName string - /*TenantID - Tenant ID of a pcloud tenant + /* TenantID. + + Tenant ID of a pcloud tenant */ TenantID string @@ -84,6 +84,21 @@ type PcloudTenantsSshkeysPutParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud tenants sshkeys put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTenantsSshkeysPutParams) WithDefaults() *PcloudTenantsSshkeysPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud tenants sshkeys put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTenantsSshkeysPutParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud tenants sshkeys put params func (o *PcloudTenantsSshkeysPutParams) WithTimeout(timeout time.Duration) *PcloudTenantsSshkeysPutParams { o.SetTimeout(timeout) @@ -157,7 +172,6 @@ func (o *PcloudTenantsSshkeysPutParams) WriteToRequest(r runtime.ClientRequest, return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_put_responses.go b/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_put_responses.go index a15df568..5d091866 100644 --- a/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_put_responses.go +++ b/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_put_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudTenantsSshkeysPutReader is a Reader for the PcloudTenantsSshkeysPut structure. @@ -24,44 +23,38 @@ type PcloudTenantsSshkeysPutReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudTenantsSshkeysPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudTenantsSshkeysPutOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudTenantsSshkeysPutBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudTenantsSshkeysPutUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudTenantsSshkeysPutUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudTenantsSshkeysPutInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudTenantsSshkeysPutOK() *PcloudTenantsSshkeysPutOK { return &PcloudTenantsSshkeysPutOK{} } -/*PcloudTenantsSshkeysPutOK handles this case with default header values. +/* PcloudTenantsSshkeysPutOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudTenantsSshkeysPutOK struct { func (o *PcloudTenantsSshkeysPutOK) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}][%d] pcloudTenantsSshkeysPutOK %+v", 200, o.Payload) } +func (o *PcloudTenantsSshkeysPutOK) GetPayload() *models.SSHKey { + return o.Payload +} func (o *PcloudTenantsSshkeysPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudTenantsSshkeysPutBadRequest() *PcloudTenantsSshkeysPutBadRequest { return &PcloudTenantsSshkeysPutBadRequest{} } -/*PcloudTenantsSshkeysPutBadRequest handles this case with default header values. +/* PcloudTenantsSshkeysPutBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudTenantsSshkeysPutBadRequest struct { func (o *PcloudTenantsSshkeysPutBadRequest) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}][%d] pcloudTenantsSshkeysPutBadRequest %+v", 400, o.Payload) } +func (o *PcloudTenantsSshkeysPutBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTenantsSshkeysPutBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudTenantsSshkeysPutUnauthorized() *PcloudTenantsSshkeysPutUnauthoriz return &PcloudTenantsSshkeysPutUnauthorized{} } -/*PcloudTenantsSshkeysPutUnauthorized handles this case with default header values. +/* PcloudTenantsSshkeysPutUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudTenantsSshkeysPutUnauthorized struct { func (o *PcloudTenantsSshkeysPutUnauthorized) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}][%d] pcloudTenantsSshkeysPutUnauthorized %+v", 401, o.Payload) } +func (o *PcloudTenantsSshkeysPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTenantsSshkeysPutUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudTenantsSshkeysPutUnprocessableEntity() *PcloudTenantsSshkeysPutUnp return &PcloudTenantsSshkeysPutUnprocessableEntity{} } -/*PcloudTenantsSshkeysPutUnprocessableEntity handles this case with default header values. +/* PcloudTenantsSshkeysPutUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -168,6 +170,9 @@ type PcloudTenantsSshkeysPutUnprocessableEntity struct { func (o *PcloudTenantsSshkeysPutUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}][%d] pcloudTenantsSshkeysPutUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudTenantsSshkeysPutUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTenantsSshkeysPutUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudTenantsSshkeysPutInternalServerError() *PcloudTenantsSshkeysPutInt return &PcloudTenantsSshkeysPutInternalServerError{} } -/*PcloudTenantsSshkeysPutInternalServerError handles this case with default header values. +/* PcloudTenantsSshkeysPutInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudTenantsSshkeysPutInternalServerError struct { func (o *PcloudTenantsSshkeysPutInternalServerError) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}][%d] pcloudTenantsSshkeysPutInternalServerError %+v", 500, o.Payload) } +func (o *PcloudTenantsSshkeysPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudTenantsSshkeysPutInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_v_p_n_connections/p_cloud_v_p_n_connections_client.go b/power/client/p_cloud_v_p_n_connections/p_cloud_v_p_n_connections_client.go deleted file mode 100644 index 0c7e4f58..00000000 --- a/power/client/p_cloud_v_p_n_connections/p_cloud_v_p_n_connections_client.go +++ /dev/null @@ -1,371 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package p_cloud_v_p_n_connections - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "github.com/go-openapi/runtime" - - strfmt "github.com/go-openapi/strfmt" -) - -// New creates a new p cloud v p n connections API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { - return &Client{transport: transport, formats: formats} -} - -/* -Client for p cloud v p n connections API -*/ -type Client struct { - transport runtime.ClientTransport - formats strfmt.Registry -} - -/* -PcloudVpnconnectionsDelete deletes v p n connection - -Delete VPN Connection (by its identifier) -*/ -func (a *Client) PcloudVpnconnectionsDelete(params *PcloudVpnconnectionsDeleteParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudVpnconnectionsDeleteAccepted, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudVpnconnectionsDeleteParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.vpnconnections.delete", - Method: "DELETE", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudVpnconnectionsDeleteReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudVpnconnectionsDeleteAccepted), nil - -} - -/* -PcloudVpnconnectionsGet gets v p n connection - -Get a VPN Connection -*/ -func (a *Client) PcloudVpnconnectionsGet(params *PcloudVpnconnectionsGetParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudVpnconnectionsGetOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudVpnconnectionsGetParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.vpnconnections.get", - Method: "GET", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudVpnconnectionsGetReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudVpnconnectionsGetOK), nil - -} - -/* -PcloudVpnconnectionsGetall gets all v p n connections - -Get all VPN Connections -*/ -func (a *Client) PcloudVpnconnectionsGetall(params *PcloudVpnconnectionsGetallParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudVpnconnectionsGetallOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudVpnconnectionsGetallParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.vpnconnections.getall", - Method: "GET", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudVpnconnectionsGetallReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudVpnconnectionsGetallOK), nil - -} - -/* -PcloudVpnconnectionsNetworksDelete detaches network - -Detach network from a specific VPN Connection -*/ -func (a *Client) PcloudVpnconnectionsNetworksDelete(params *PcloudVpnconnectionsNetworksDeleteParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudVpnconnectionsNetworksDeleteAccepted, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudVpnconnectionsNetworksDeleteParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.vpnconnections.networks.delete", - Method: "DELETE", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudVpnconnectionsNetworksDeleteReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudVpnconnectionsNetworksDeleteAccepted), nil - -} - -/* -PcloudVpnconnectionsNetworksGet gets attached networks - -Get a list of network IDs attached to a VPN Connection -*/ -func (a *Client) PcloudVpnconnectionsNetworksGet(params *PcloudVpnconnectionsNetworksGetParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudVpnconnectionsNetworksGetOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudVpnconnectionsNetworksGetParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.vpnconnections.networks.get", - Method: "GET", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudVpnconnectionsNetworksGetReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudVpnconnectionsNetworksGetOK), nil - -} - -/* -PcloudVpnconnectionsNetworksPut attaches network - -Attach a network to a VPN Connection -*/ -func (a *Client) PcloudVpnconnectionsNetworksPut(params *PcloudVpnconnectionsNetworksPutParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudVpnconnectionsNetworksPutAccepted, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudVpnconnectionsNetworksPutParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.vpnconnections.networks.put", - Method: "PUT", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudVpnconnectionsNetworksPutReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudVpnconnectionsNetworksPutAccepted), nil - -} - -/* -PcloudVpnconnectionsPeersubnetsDelete detaches peer subnet - -Detach peer subnet from a VPN Connection -*/ -func (a *Client) PcloudVpnconnectionsPeersubnetsDelete(params *PcloudVpnconnectionsPeersubnetsDeleteParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudVpnconnectionsPeersubnetsDeleteOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudVpnconnectionsPeersubnetsDeleteParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.vpnconnections.peersubnets.delete", - Method: "DELETE", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudVpnconnectionsPeersubnetsDeleteReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudVpnconnectionsPeersubnetsDeleteOK), nil - -} - -/* -PcloudVpnconnectionsPeersubnetsGet gets peer subnets - -Get a list of peer subnets attached to a specific VPN Connection -*/ -func (a *Client) PcloudVpnconnectionsPeersubnetsGet(params *PcloudVpnconnectionsPeersubnetsGetParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudVpnconnectionsPeersubnetsGetOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudVpnconnectionsPeersubnetsGetParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.vpnconnections.peersubnets.get", - Method: "GET", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudVpnconnectionsPeersubnetsGetReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudVpnconnectionsPeersubnetsGetOK), nil - -} - -/* -PcloudVpnconnectionsPeersubnetsPut attaches peer subnet - -Attach peer subnet to a VPN Connection -*/ -func (a *Client) PcloudVpnconnectionsPeersubnetsPut(params *PcloudVpnconnectionsPeersubnetsPutParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudVpnconnectionsPeersubnetsPutOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudVpnconnectionsPeersubnetsPutParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.vpnconnections.peersubnets.put", - Method: "PUT", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudVpnconnectionsPeersubnetsPutReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudVpnconnectionsPeersubnetsPutOK), nil - -} - -/* -PcloudVpnconnectionsPost creates v p n connection - -Create a new VPN Connection -*/ -func (a *Client) PcloudVpnconnectionsPost(params *PcloudVpnconnectionsPostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudVpnconnectionsPostAccepted, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudVpnconnectionsPostParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.vpnconnections.post", - Method: "POST", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudVpnconnectionsPostReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudVpnconnectionsPostAccepted), nil - -} - -/* -PcloudVpnconnectionsPut updates v p n connection - -update a VPN Connection (by its identifier) -*/ -func (a *Client) PcloudVpnconnectionsPut(params *PcloudVpnconnectionsPutParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudVpnconnectionsPutOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudVpnconnectionsPutParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.vpnconnections.put", - Method: "PUT", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudVpnconnectionsPutReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudVpnconnectionsPutOK), nil - -} - -// SetTransport changes the transport on the client -func (a *Client) SetTransport(transport runtime.ClientTransport) { - a.transport = transport -} diff --git a/power/client/p_cloud_v_p_n_connections/p_cloudvpn_connections_client.go b/power/client/p_cloud_v_p_n_connections/p_cloudvpn_connections_client.go new file mode 100644 index 00000000..95a58fbe --- /dev/null +++ b/power/client/p_cloud_v_p_n_connections/p_cloudvpn_connections_client.go @@ -0,0 +1,512 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_connections + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// New creates a new p cloud v p n connections API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for p cloud v p n connections API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudVpnconnectionsDelete(params *PcloudVpnconnectionsDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsDeleteAccepted, error) + + PcloudVpnconnectionsGet(params *PcloudVpnconnectionsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsGetOK, error) + + PcloudVpnconnectionsGetall(params *PcloudVpnconnectionsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsGetallOK, error) + + PcloudVpnconnectionsNetworksDelete(params *PcloudVpnconnectionsNetworksDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsNetworksDeleteAccepted, error) + + PcloudVpnconnectionsNetworksGet(params *PcloudVpnconnectionsNetworksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsNetworksGetOK, error) + + PcloudVpnconnectionsNetworksPut(params *PcloudVpnconnectionsNetworksPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsNetworksPutAccepted, error) + + PcloudVpnconnectionsPeersubnetsDelete(params *PcloudVpnconnectionsPeersubnetsDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsPeersubnetsDeleteOK, error) + + PcloudVpnconnectionsPeersubnetsGet(params *PcloudVpnconnectionsPeersubnetsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsPeersubnetsGetOK, error) + + PcloudVpnconnectionsPeersubnetsPut(params *PcloudVpnconnectionsPeersubnetsPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsPeersubnetsPutOK, error) + + PcloudVpnconnectionsPost(params *PcloudVpnconnectionsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsPostAccepted, error) + + PcloudVpnconnectionsPut(params *PcloudVpnconnectionsPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsPutOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + PcloudVpnconnectionsDelete deletes v p n connection + + Delete VPN Connection (by its identifier) +*/ +func (a *Client) PcloudVpnconnectionsDelete(params *PcloudVpnconnectionsDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsDeleteAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudVpnconnectionsDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.vpnconnections.delete", + Method: "DELETE", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudVpnconnectionsDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudVpnconnectionsDeleteAccepted) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.vpnconnections.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudVpnconnectionsGet gets v p n connection + + Get a VPN Connection +*/ +func (a *Client) PcloudVpnconnectionsGet(params *PcloudVpnconnectionsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudVpnconnectionsGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.vpnconnections.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudVpnconnectionsGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudVpnconnectionsGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.vpnconnections.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudVpnconnectionsGetall gets all v p n connections + + Get all VPN Connections +*/ +func (a *Client) PcloudVpnconnectionsGetall(params *PcloudVpnconnectionsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudVpnconnectionsGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.vpnconnections.getall", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudVpnconnectionsGetallReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudVpnconnectionsGetallOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.vpnconnections.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudVpnconnectionsNetworksDelete detaches network + + Detach network from a specific VPN Connection +*/ +func (a *Client) PcloudVpnconnectionsNetworksDelete(params *PcloudVpnconnectionsNetworksDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsNetworksDeleteAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudVpnconnectionsNetworksDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.vpnconnections.networks.delete", + Method: "DELETE", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudVpnconnectionsNetworksDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudVpnconnectionsNetworksDeleteAccepted) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.vpnconnections.networks.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudVpnconnectionsNetworksGet gets attached networks + + Get a list of network IDs attached to a VPN Connection +*/ +func (a *Client) PcloudVpnconnectionsNetworksGet(params *PcloudVpnconnectionsNetworksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsNetworksGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudVpnconnectionsNetworksGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.vpnconnections.networks.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudVpnconnectionsNetworksGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudVpnconnectionsNetworksGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.vpnconnections.networks.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudVpnconnectionsNetworksPut attaches network + + Attach a network to a VPN Connection +*/ +func (a *Client) PcloudVpnconnectionsNetworksPut(params *PcloudVpnconnectionsNetworksPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsNetworksPutAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudVpnconnectionsNetworksPutParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.vpnconnections.networks.put", + Method: "PUT", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudVpnconnectionsNetworksPutReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudVpnconnectionsNetworksPutAccepted) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.vpnconnections.networks.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudVpnconnectionsPeersubnetsDelete detaches peer subnet + + Detach peer subnet from a VPN Connection +*/ +func (a *Client) PcloudVpnconnectionsPeersubnetsDelete(params *PcloudVpnconnectionsPeersubnetsDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsPeersubnetsDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudVpnconnectionsPeersubnetsDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.vpnconnections.peersubnets.delete", + Method: "DELETE", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudVpnconnectionsPeersubnetsDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudVpnconnectionsPeersubnetsDeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.vpnconnections.peersubnets.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudVpnconnectionsPeersubnetsGet gets peer subnets + + Get a list of peer subnets attached to a specific VPN Connection +*/ +func (a *Client) PcloudVpnconnectionsPeersubnetsGet(params *PcloudVpnconnectionsPeersubnetsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsPeersubnetsGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudVpnconnectionsPeersubnetsGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.vpnconnections.peersubnets.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudVpnconnectionsPeersubnetsGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudVpnconnectionsPeersubnetsGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.vpnconnections.peersubnets.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudVpnconnectionsPeersubnetsPut attaches peer subnet + + Attach peer subnet to a VPN Connection +*/ +func (a *Client) PcloudVpnconnectionsPeersubnetsPut(params *PcloudVpnconnectionsPeersubnetsPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsPeersubnetsPutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudVpnconnectionsPeersubnetsPutParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.vpnconnections.peersubnets.put", + Method: "PUT", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudVpnconnectionsPeersubnetsPutReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudVpnconnectionsPeersubnetsPutOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.vpnconnections.peersubnets.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudVpnconnectionsPost creates v p n connection + + Create a new VPN Connection +*/ +func (a *Client) PcloudVpnconnectionsPost(params *PcloudVpnconnectionsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsPostAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudVpnconnectionsPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.vpnconnections.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudVpnconnectionsPostReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudVpnconnectionsPostAccepted) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.vpnconnections.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudVpnconnectionsPut updates v p n connection + + update a VPN Connection (by its identifier) +*/ +func (a *Client) PcloudVpnconnectionsPut(params *PcloudVpnconnectionsPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsPutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudVpnconnectionsPutParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.vpnconnections.put", + Method: "PUT", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudVpnconnectionsPutReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudVpnconnectionsPutOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.vpnconnections.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_delete_parameters.go b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_delete_parameters.go index 4c314278..6bb03a9b 100644 --- a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_delete_parameters.go +++ b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_delete_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudVpnconnectionsDeleteParams creates a new PcloudVpnconnectionsDeleteParams object -// with the default values initialized. +// NewPcloudVpnconnectionsDeleteParams creates a new PcloudVpnconnectionsDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudVpnconnectionsDeleteParams() *PcloudVpnconnectionsDeleteParams { - var () return &PcloudVpnconnectionsDeleteParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudVpnconnectionsDeleteParamsWithTimeout creates a new PcloudVpnconnectionsDeleteParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudVpnconnectionsDeleteParamsWithTimeout(timeout time.Duration) *PcloudVpnconnectionsDeleteParams { - var () return &PcloudVpnconnectionsDeleteParams{ - timeout: timeout, } } // NewPcloudVpnconnectionsDeleteParamsWithContext creates a new PcloudVpnconnectionsDeleteParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudVpnconnectionsDeleteParamsWithContext(ctx context.Context) *PcloudVpnconnectionsDeleteParams { - var () return &PcloudVpnconnectionsDeleteParams{ - Context: ctx, } } // NewPcloudVpnconnectionsDeleteParamsWithHTTPClient creates a new PcloudVpnconnectionsDeleteParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudVpnconnectionsDeleteParamsWithHTTPClient(client *http.Client) *PcloudVpnconnectionsDeleteParams { - var () return &PcloudVpnconnectionsDeleteParams{ HTTPClient: client, } } -/*PcloudVpnconnectionsDeleteParams contains all the parameters to send to the API endpoint -for the pcloud vpnconnections delete operation typically these are written to a http.Request +/* PcloudVpnconnectionsDeleteParams contains all the parameters to send to the API endpoint + for the pcloud vpnconnections delete operation. + + Typically these are written to a http.Request. */ type PcloudVpnconnectionsDeleteParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*VpnConnectionID - ID of a VPN connection + /* VpnConnectionID. + + ID of a VPN connection */ VpnConnectionID string @@ -77,6 +76,21 @@ type PcloudVpnconnectionsDeleteParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud vpnconnections delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsDeleteParams) WithDefaults() *PcloudVpnconnectionsDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud vpnconnections delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud vpnconnections delete params func (o *PcloudVpnconnectionsDeleteParams) WithTimeout(timeout time.Duration) *PcloudVpnconnectionsDeleteParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_delete_responses.go b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_delete_responses.go index 20533e9d..cd546b15 100644 --- a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_delete_responses.go +++ b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_delete_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudVpnconnectionsDeleteReader is a Reader for the PcloudVpnconnectionsDelete structure. @@ -24,51 +23,44 @@ type PcloudVpnconnectionsDeleteReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudVpnconnectionsDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 202: result := NewPcloudVpnconnectionsDeleteAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudVpnconnectionsDeleteBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudVpnconnectionsDeleteUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 403: result := NewPcloudVpnconnectionsDeleteForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudVpnconnectionsDeleteNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudVpnconnectionsDeleteInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -77,7 +69,7 @@ func NewPcloudVpnconnectionsDeleteAccepted() *PcloudVpnconnectionsDeleteAccepted return &PcloudVpnconnectionsDeleteAccepted{} } -/*PcloudVpnconnectionsDeleteAccepted handles this case with default header values. +/* PcloudVpnconnectionsDeleteAccepted describes a response with status code 202, with default header values. Accepted */ @@ -88,6 +80,9 @@ type PcloudVpnconnectionsDeleteAccepted struct { func (o *PcloudVpnconnectionsDeleteAccepted) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsDeleteAccepted %+v", 202, o.Payload) } +func (o *PcloudVpnconnectionsDeleteAccepted) GetPayload() *models.JobReference { + return o.Payload +} func (o *PcloudVpnconnectionsDeleteAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -106,7 +101,7 @@ func NewPcloudVpnconnectionsDeleteBadRequest() *PcloudVpnconnectionsDeleteBadReq return &PcloudVpnconnectionsDeleteBadRequest{} } -/*PcloudVpnconnectionsDeleteBadRequest handles this case with default header values. +/* PcloudVpnconnectionsDeleteBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -117,6 +112,9 @@ type PcloudVpnconnectionsDeleteBadRequest struct { func (o *PcloudVpnconnectionsDeleteBadRequest) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsDeleteBadRequest %+v", 400, o.Payload) } +func (o *PcloudVpnconnectionsDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -135,7 +133,7 @@ func NewPcloudVpnconnectionsDeleteUnauthorized() *PcloudVpnconnectionsDeleteUnau return &PcloudVpnconnectionsDeleteUnauthorized{} } -/*PcloudVpnconnectionsDeleteUnauthorized handles this case with default header values. +/* PcloudVpnconnectionsDeleteUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -146,6 +144,9 @@ type PcloudVpnconnectionsDeleteUnauthorized struct { func (o *PcloudVpnconnectionsDeleteUnauthorized) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsDeleteUnauthorized %+v", 401, o.Payload) } +func (o *PcloudVpnconnectionsDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -164,7 +165,7 @@ func NewPcloudVpnconnectionsDeleteForbidden() *PcloudVpnconnectionsDeleteForbidd return &PcloudVpnconnectionsDeleteForbidden{} } -/*PcloudVpnconnectionsDeleteForbidden handles this case with default header values. +/* PcloudVpnconnectionsDeleteForbidden describes a response with status code 403, with default header values. Forbidden */ @@ -175,6 +176,9 @@ type PcloudVpnconnectionsDeleteForbidden struct { func (o *PcloudVpnconnectionsDeleteForbidden) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsDeleteForbidden %+v", 403, o.Payload) } +func (o *PcloudVpnconnectionsDeleteForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsDeleteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -193,7 +197,7 @@ func NewPcloudVpnconnectionsDeleteNotFound() *PcloudVpnconnectionsDeleteNotFound return &PcloudVpnconnectionsDeleteNotFound{} } -/*PcloudVpnconnectionsDeleteNotFound handles this case with default header values. +/* PcloudVpnconnectionsDeleteNotFound describes a response with status code 404, with default header values. Not Found */ @@ -204,6 +208,9 @@ type PcloudVpnconnectionsDeleteNotFound struct { func (o *PcloudVpnconnectionsDeleteNotFound) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsDeleteNotFound %+v", 404, o.Payload) } +func (o *PcloudVpnconnectionsDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -222,7 +229,7 @@ func NewPcloudVpnconnectionsDeleteInternalServerError() *PcloudVpnconnectionsDel return &PcloudVpnconnectionsDeleteInternalServerError{} } -/*PcloudVpnconnectionsDeleteInternalServerError handles this case with default header values. +/* PcloudVpnconnectionsDeleteInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -233,6 +240,9 @@ type PcloudVpnconnectionsDeleteInternalServerError struct { func (o *PcloudVpnconnectionsDeleteInternalServerError) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsDeleteInternalServerError %+v", 500, o.Payload) } +func (o *PcloudVpnconnectionsDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_get_parameters.go b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_get_parameters.go index 0f39ece1..9e34b496 100644 --- a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_get_parameters.go +++ b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_get_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudVpnconnectionsGetParams creates a new PcloudVpnconnectionsGetParams object -// with the default values initialized. +// NewPcloudVpnconnectionsGetParams creates a new PcloudVpnconnectionsGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudVpnconnectionsGetParams() *PcloudVpnconnectionsGetParams { - var () return &PcloudVpnconnectionsGetParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudVpnconnectionsGetParamsWithTimeout creates a new PcloudVpnconnectionsGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudVpnconnectionsGetParamsWithTimeout(timeout time.Duration) *PcloudVpnconnectionsGetParams { - var () return &PcloudVpnconnectionsGetParams{ - timeout: timeout, } } // NewPcloudVpnconnectionsGetParamsWithContext creates a new PcloudVpnconnectionsGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudVpnconnectionsGetParamsWithContext(ctx context.Context) *PcloudVpnconnectionsGetParams { - var () return &PcloudVpnconnectionsGetParams{ - Context: ctx, } } // NewPcloudVpnconnectionsGetParamsWithHTTPClient creates a new PcloudVpnconnectionsGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudVpnconnectionsGetParamsWithHTTPClient(client *http.Client) *PcloudVpnconnectionsGetParams { - var () return &PcloudVpnconnectionsGetParams{ HTTPClient: client, } } -/*PcloudVpnconnectionsGetParams contains all the parameters to send to the API endpoint -for the pcloud vpnconnections get operation typically these are written to a http.Request +/* PcloudVpnconnectionsGetParams contains all the parameters to send to the API endpoint + for the pcloud vpnconnections get operation. + + Typically these are written to a http.Request. */ type PcloudVpnconnectionsGetParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*VpnConnectionID - ID of a VPN connection + /* VpnConnectionID. + + ID of a VPN connection */ VpnConnectionID string @@ -77,6 +76,21 @@ type PcloudVpnconnectionsGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud vpnconnections get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsGetParams) WithDefaults() *PcloudVpnconnectionsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud vpnconnections get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud vpnconnections get params func (o *PcloudVpnconnectionsGetParams) WithTimeout(timeout time.Duration) *PcloudVpnconnectionsGetParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_get_responses.go b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_get_responses.go index 59d6ba75..79413add 100644 --- a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_get_responses.go +++ b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudVpnconnectionsGetReader is a Reader for the PcloudVpnconnectionsGet structure. @@ -24,58 +23,50 @@ type PcloudVpnconnectionsGetReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudVpnconnectionsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudVpnconnectionsGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudVpnconnectionsGetBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudVpnconnectionsGetUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 403: result := NewPcloudVpnconnectionsGetForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudVpnconnectionsGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudVpnconnectionsGetUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudVpnconnectionsGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -84,7 +75,7 @@ func NewPcloudVpnconnectionsGetOK() *PcloudVpnconnectionsGetOK { return &PcloudVpnconnectionsGetOK{} } -/*PcloudVpnconnectionsGetOK handles this case with default header values. +/* PcloudVpnconnectionsGetOK describes a response with status code 200, with default header values. OK */ @@ -95,6 +86,9 @@ type PcloudVpnconnectionsGetOK struct { func (o *PcloudVpnconnectionsGetOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsGetOK %+v", 200, o.Payload) } +func (o *PcloudVpnconnectionsGetOK) GetPayload() *models.VPNConnection { + return o.Payload +} func (o *PcloudVpnconnectionsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -113,7 +107,7 @@ func NewPcloudVpnconnectionsGetBadRequest() *PcloudVpnconnectionsGetBadRequest { return &PcloudVpnconnectionsGetBadRequest{} } -/*PcloudVpnconnectionsGetBadRequest handles this case with default header values. +/* PcloudVpnconnectionsGetBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -124,6 +118,9 @@ type PcloudVpnconnectionsGetBadRequest struct { func (o *PcloudVpnconnectionsGetBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsGetBadRequest %+v", 400, o.Payload) } +func (o *PcloudVpnconnectionsGetBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -142,7 +139,7 @@ func NewPcloudVpnconnectionsGetUnauthorized() *PcloudVpnconnectionsGetUnauthoriz return &PcloudVpnconnectionsGetUnauthorized{} } -/*PcloudVpnconnectionsGetUnauthorized handles this case with default header values. +/* PcloudVpnconnectionsGetUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -153,6 +150,9 @@ type PcloudVpnconnectionsGetUnauthorized struct { func (o *PcloudVpnconnectionsGetUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsGetUnauthorized %+v", 401, o.Payload) } +func (o *PcloudVpnconnectionsGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -171,7 +171,7 @@ func NewPcloudVpnconnectionsGetForbidden() *PcloudVpnconnectionsGetForbidden { return &PcloudVpnconnectionsGetForbidden{} } -/*PcloudVpnconnectionsGetForbidden handles this case with default header values. +/* PcloudVpnconnectionsGetForbidden describes a response with status code 403, with default header values. Forbidden */ @@ -182,6 +182,9 @@ type PcloudVpnconnectionsGetForbidden struct { func (o *PcloudVpnconnectionsGetForbidden) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsGetForbidden %+v", 403, o.Payload) } +func (o *PcloudVpnconnectionsGetForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -200,7 +203,7 @@ func NewPcloudVpnconnectionsGetNotFound() *PcloudVpnconnectionsGetNotFound { return &PcloudVpnconnectionsGetNotFound{} } -/*PcloudVpnconnectionsGetNotFound handles this case with default header values. +/* PcloudVpnconnectionsGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -211,6 +214,9 @@ type PcloudVpnconnectionsGetNotFound struct { func (o *PcloudVpnconnectionsGetNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsGetNotFound %+v", 404, o.Payload) } +func (o *PcloudVpnconnectionsGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -229,7 +235,7 @@ func NewPcloudVpnconnectionsGetUnprocessableEntity() *PcloudVpnconnectionsGetUnp return &PcloudVpnconnectionsGetUnprocessableEntity{} } -/*PcloudVpnconnectionsGetUnprocessableEntity handles this case with default header values. +/* PcloudVpnconnectionsGetUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -240,6 +246,9 @@ type PcloudVpnconnectionsGetUnprocessableEntity struct { func (o *PcloudVpnconnectionsGetUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsGetUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudVpnconnectionsGetUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsGetUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -258,7 +267,7 @@ func NewPcloudVpnconnectionsGetInternalServerError() *PcloudVpnconnectionsGetInt return &PcloudVpnconnectionsGetInternalServerError{} } -/*PcloudVpnconnectionsGetInternalServerError handles this case with default header values. +/* PcloudVpnconnectionsGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -269,6 +278,9 @@ type PcloudVpnconnectionsGetInternalServerError struct { func (o *PcloudVpnconnectionsGetInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsGetInternalServerError %+v", 500, o.Payload) } +func (o *PcloudVpnconnectionsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_getall_parameters.go b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_getall_parameters.go index d1d00f5d..08d55e3a 100644 --- a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_getall_parameters.go +++ b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_getall_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudVpnconnectionsGetallParams creates a new PcloudVpnconnectionsGetallParams object -// with the default values initialized. +// NewPcloudVpnconnectionsGetallParams creates a new PcloudVpnconnectionsGetallParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudVpnconnectionsGetallParams() *PcloudVpnconnectionsGetallParams { - var () return &PcloudVpnconnectionsGetallParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudVpnconnectionsGetallParamsWithTimeout creates a new PcloudVpnconnectionsGetallParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudVpnconnectionsGetallParamsWithTimeout(timeout time.Duration) *PcloudVpnconnectionsGetallParams { - var () return &PcloudVpnconnectionsGetallParams{ - timeout: timeout, } } // NewPcloudVpnconnectionsGetallParamsWithContext creates a new PcloudVpnconnectionsGetallParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudVpnconnectionsGetallParamsWithContext(ctx context.Context) *PcloudVpnconnectionsGetallParams { - var () return &PcloudVpnconnectionsGetallParams{ - Context: ctx, } } // NewPcloudVpnconnectionsGetallParamsWithHTTPClient creates a new PcloudVpnconnectionsGetallParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudVpnconnectionsGetallParamsWithHTTPClient(client *http.Client) *PcloudVpnconnectionsGetallParams { - var () return &PcloudVpnconnectionsGetallParams{ HTTPClient: client, } } -/*PcloudVpnconnectionsGetallParams contains all the parameters to send to the API endpoint -for the pcloud vpnconnections getall operation typically these are written to a http.Request +/* PcloudVpnconnectionsGetallParams contains all the parameters to send to the API endpoint + for the pcloud vpnconnections getall operation. + + Typically these are written to a http.Request. */ type PcloudVpnconnectionsGetallParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -72,6 +70,21 @@ type PcloudVpnconnectionsGetallParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud vpnconnections getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsGetallParams) WithDefaults() *PcloudVpnconnectionsGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud vpnconnections getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsGetallParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud vpnconnections getall params func (o *PcloudVpnconnectionsGetallParams) WithTimeout(timeout time.Duration) *PcloudVpnconnectionsGetallParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_getall_responses.go b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_getall_responses.go index ef63a3b9..487398c7 100644 --- a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_getall_responses.go +++ b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_getall_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudVpnconnectionsGetallReader is a Reader for the PcloudVpnconnectionsGetall structure. @@ -24,51 +23,44 @@ type PcloudVpnconnectionsGetallReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudVpnconnectionsGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudVpnconnectionsGetallOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudVpnconnectionsGetallBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudVpnconnectionsGetallUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 403: result := NewPcloudVpnconnectionsGetallForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudVpnconnectionsGetallNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudVpnconnectionsGetallInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -77,7 +69,7 @@ func NewPcloudVpnconnectionsGetallOK() *PcloudVpnconnectionsGetallOK { return &PcloudVpnconnectionsGetallOK{} } -/*PcloudVpnconnectionsGetallOK handles this case with default header values. +/* PcloudVpnconnectionsGetallOK describes a response with status code 200, with default header values. OK */ @@ -88,6 +80,9 @@ type PcloudVpnconnectionsGetallOK struct { func (o *PcloudVpnconnectionsGetallOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections][%d] pcloudVpnconnectionsGetallOK %+v", 200, o.Payload) } +func (o *PcloudVpnconnectionsGetallOK) GetPayload() *models.VPNConnections { + return o.Payload +} func (o *PcloudVpnconnectionsGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -106,7 +101,7 @@ func NewPcloudVpnconnectionsGetallBadRequest() *PcloudVpnconnectionsGetallBadReq return &PcloudVpnconnectionsGetallBadRequest{} } -/*PcloudVpnconnectionsGetallBadRequest handles this case with default header values. +/* PcloudVpnconnectionsGetallBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -117,6 +112,9 @@ type PcloudVpnconnectionsGetallBadRequest struct { func (o *PcloudVpnconnectionsGetallBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections][%d] pcloudVpnconnectionsGetallBadRequest %+v", 400, o.Payload) } +func (o *PcloudVpnconnectionsGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsGetallBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -135,7 +133,7 @@ func NewPcloudVpnconnectionsGetallUnauthorized() *PcloudVpnconnectionsGetallUnau return &PcloudVpnconnectionsGetallUnauthorized{} } -/*PcloudVpnconnectionsGetallUnauthorized handles this case with default header values. +/* PcloudVpnconnectionsGetallUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -146,6 +144,9 @@ type PcloudVpnconnectionsGetallUnauthorized struct { func (o *PcloudVpnconnectionsGetallUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections][%d] pcloudVpnconnectionsGetallUnauthorized %+v", 401, o.Payload) } +func (o *PcloudVpnconnectionsGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsGetallUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -164,7 +165,7 @@ func NewPcloudVpnconnectionsGetallForbidden() *PcloudVpnconnectionsGetallForbidd return &PcloudVpnconnectionsGetallForbidden{} } -/*PcloudVpnconnectionsGetallForbidden handles this case with default header values. +/* PcloudVpnconnectionsGetallForbidden describes a response with status code 403, with default header values. Forbidden */ @@ -175,6 +176,9 @@ type PcloudVpnconnectionsGetallForbidden struct { func (o *PcloudVpnconnectionsGetallForbidden) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections][%d] pcloudVpnconnectionsGetallForbidden %+v", 403, o.Payload) } +func (o *PcloudVpnconnectionsGetallForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsGetallForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -193,7 +197,7 @@ func NewPcloudVpnconnectionsGetallNotFound() *PcloudVpnconnectionsGetallNotFound return &PcloudVpnconnectionsGetallNotFound{} } -/*PcloudVpnconnectionsGetallNotFound handles this case with default header values. +/* PcloudVpnconnectionsGetallNotFound describes a response with status code 404, with default header values. Not Found */ @@ -204,6 +208,9 @@ type PcloudVpnconnectionsGetallNotFound struct { func (o *PcloudVpnconnectionsGetallNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections][%d] pcloudVpnconnectionsGetallNotFound %+v", 404, o.Payload) } +func (o *PcloudVpnconnectionsGetallNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsGetallNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -222,7 +229,7 @@ func NewPcloudVpnconnectionsGetallInternalServerError() *PcloudVpnconnectionsGet return &PcloudVpnconnectionsGetallInternalServerError{} } -/*PcloudVpnconnectionsGetallInternalServerError handles this case with default header values. +/* PcloudVpnconnectionsGetallInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -233,6 +240,9 @@ type PcloudVpnconnectionsGetallInternalServerError struct { func (o *PcloudVpnconnectionsGetallInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections][%d] pcloudVpnconnectionsGetallInternalServerError %+v", 500, o.Payload) } +func (o *PcloudVpnconnectionsGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsGetallInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_delete_parameters.go b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_delete_parameters.go index 8c3cd6ff..a7b4b14a 100644 --- a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_delete_parameters.go +++ b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_delete_parameters.go @@ -13,69 +13,69 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudVpnconnectionsNetworksDeleteParams creates a new PcloudVpnconnectionsNetworksDeleteParams object -// with the default values initialized. +// NewPcloudVpnconnectionsNetworksDeleteParams creates a new PcloudVpnconnectionsNetworksDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudVpnconnectionsNetworksDeleteParams() *PcloudVpnconnectionsNetworksDeleteParams { - var () return &PcloudVpnconnectionsNetworksDeleteParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudVpnconnectionsNetworksDeleteParamsWithTimeout creates a new PcloudVpnconnectionsNetworksDeleteParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudVpnconnectionsNetworksDeleteParamsWithTimeout(timeout time.Duration) *PcloudVpnconnectionsNetworksDeleteParams { - var () return &PcloudVpnconnectionsNetworksDeleteParams{ - timeout: timeout, } } // NewPcloudVpnconnectionsNetworksDeleteParamsWithContext creates a new PcloudVpnconnectionsNetworksDeleteParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudVpnconnectionsNetworksDeleteParamsWithContext(ctx context.Context) *PcloudVpnconnectionsNetworksDeleteParams { - var () return &PcloudVpnconnectionsNetworksDeleteParams{ - Context: ctx, } } // NewPcloudVpnconnectionsNetworksDeleteParamsWithHTTPClient creates a new PcloudVpnconnectionsNetworksDeleteParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudVpnconnectionsNetworksDeleteParamsWithHTTPClient(client *http.Client) *PcloudVpnconnectionsNetworksDeleteParams { - var () return &PcloudVpnconnectionsNetworksDeleteParams{ HTTPClient: client, } } -/*PcloudVpnconnectionsNetworksDeleteParams contains all the parameters to send to the API endpoint -for the pcloud vpnconnections networks delete operation typically these are written to a http.Request +/* PcloudVpnconnectionsNetworksDeleteParams contains all the parameters to send to the API endpoint + for the pcloud vpnconnections networks delete operation. + + Typically these are written to a http.Request. */ type PcloudVpnconnectionsNetworksDeleteParams struct { - /*Body - network to detach + /* Body. + network to detach */ Body *models.NetworkID - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*VpnConnectionID - ID of a VPN connection + /* VpnConnectionID. + + ID of a VPN connection */ VpnConnectionID string @@ -84,6 +84,21 @@ type PcloudVpnconnectionsNetworksDeleteParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud vpnconnections networks delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsNetworksDeleteParams) WithDefaults() *PcloudVpnconnectionsNetworksDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud vpnconnections networks delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsNetworksDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud vpnconnections networks delete params func (o *PcloudVpnconnectionsNetworksDeleteParams) WithTimeout(timeout time.Duration) *PcloudVpnconnectionsNetworksDeleteParams { o.SetTimeout(timeout) @@ -157,7 +172,6 @@ func (o *PcloudVpnconnectionsNetworksDeleteParams) WriteToRequest(r runtime.Clie return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_delete_responses.go b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_delete_responses.go index 96db174d..4d2685a4 100644 --- a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_delete_responses.go +++ b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_delete_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudVpnconnectionsNetworksDeleteReader is a Reader for the PcloudVpnconnectionsNetworksDelete structure. @@ -24,58 +23,50 @@ type PcloudVpnconnectionsNetworksDeleteReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudVpnconnectionsNetworksDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 202: result := NewPcloudVpnconnectionsNetworksDeleteAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudVpnconnectionsNetworksDeleteBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudVpnconnectionsNetworksDeleteUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 403: result := NewPcloudVpnconnectionsNetworksDeleteForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudVpnconnectionsNetworksDeleteNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudVpnconnectionsNetworksDeleteUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudVpnconnectionsNetworksDeleteInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -84,7 +75,7 @@ func NewPcloudVpnconnectionsNetworksDeleteAccepted() *PcloudVpnconnectionsNetwor return &PcloudVpnconnectionsNetworksDeleteAccepted{} } -/*PcloudVpnconnectionsNetworksDeleteAccepted handles this case with default header values. +/* PcloudVpnconnectionsNetworksDeleteAccepted describes a response with status code 202, with default header values. Accepted */ @@ -95,6 +86,9 @@ type PcloudVpnconnectionsNetworksDeleteAccepted struct { func (o *PcloudVpnconnectionsNetworksDeleteAccepted) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksDeleteAccepted %+v", 202, o.Payload) } +func (o *PcloudVpnconnectionsNetworksDeleteAccepted) GetPayload() *models.JobReference { + return o.Payload +} func (o *PcloudVpnconnectionsNetworksDeleteAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -113,7 +107,7 @@ func NewPcloudVpnconnectionsNetworksDeleteBadRequest() *PcloudVpnconnectionsNetw return &PcloudVpnconnectionsNetworksDeleteBadRequest{} } -/*PcloudVpnconnectionsNetworksDeleteBadRequest handles this case with default header values. +/* PcloudVpnconnectionsNetworksDeleteBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -124,6 +118,9 @@ type PcloudVpnconnectionsNetworksDeleteBadRequest struct { func (o *PcloudVpnconnectionsNetworksDeleteBadRequest) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksDeleteBadRequest %+v", 400, o.Payload) } +func (o *PcloudVpnconnectionsNetworksDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsNetworksDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -142,7 +139,7 @@ func NewPcloudVpnconnectionsNetworksDeleteUnauthorized() *PcloudVpnconnectionsNe return &PcloudVpnconnectionsNetworksDeleteUnauthorized{} } -/*PcloudVpnconnectionsNetworksDeleteUnauthorized handles this case with default header values. +/* PcloudVpnconnectionsNetworksDeleteUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -153,6 +150,9 @@ type PcloudVpnconnectionsNetworksDeleteUnauthorized struct { func (o *PcloudVpnconnectionsNetworksDeleteUnauthorized) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksDeleteUnauthorized %+v", 401, o.Payload) } +func (o *PcloudVpnconnectionsNetworksDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsNetworksDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -171,7 +171,7 @@ func NewPcloudVpnconnectionsNetworksDeleteForbidden() *PcloudVpnconnectionsNetwo return &PcloudVpnconnectionsNetworksDeleteForbidden{} } -/*PcloudVpnconnectionsNetworksDeleteForbidden handles this case with default header values. +/* PcloudVpnconnectionsNetworksDeleteForbidden describes a response with status code 403, with default header values. Forbidden */ @@ -182,6 +182,9 @@ type PcloudVpnconnectionsNetworksDeleteForbidden struct { func (o *PcloudVpnconnectionsNetworksDeleteForbidden) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksDeleteForbidden %+v", 403, o.Payload) } +func (o *PcloudVpnconnectionsNetworksDeleteForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsNetworksDeleteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -200,7 +203,7 @@ func NewPcloudVpnconnectionsNetworksDeleteNotFound() *PcloudVpnconnectionsNetwor return &PcloudVpnconnectionsNetworksDeleteNotFound{} } -/*PcloudVpnconnectionsNetworksDeleteNotFound handles this case with default header values. +/* PcloudVpnconnectionsNetworksDeleteNotFound describes a response with status code 404, with default header values. Not Found */ @@ -211,6 +214,9 @@ type PcloudVpnconnectionsNetworksDeleteNotFound struct { func (o *PcloudVpnconnectionsNetworksDeleteNotFound) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksDeleteNotFound %+v", 404, o.Payload) } +func (o *PcloudVpnconnectionsNetworksDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsNetworksDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -229,7 +235,7 @@ func NewPcloudVpnconnectionsNetworksDeleteUnprocessableEntity() *PcloudVpnconnec return &PcloudVpnconnectionsNetworksDeleteUnprocessableEntity{} } -/*PcloudVpnconnectionsNetworksDeleteUnprocessableEntity handles this case with default header values. +/* PcloudVpnconnectionsNetworksDeleteUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -240,6 +246,9 @@ type PcloudVpnconnectionsNetworksDeleteUnprocessableEntity struct { func (o *PcloudVpnconnectionsNetworksDeleteUnprocessableEntity) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksDeleteUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudVpnconnectionsNetworksDeleteUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsNetworksDeleteUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -258,7 +267,7 @@ func NewPcloudVpnconnectionsNetworksDeleteInternalServerError() *PcloudVpnconnec return &PcloudVpnconnectionsNetworksDeleteInternalServerError{} } -/*PcloudVpnconnectionsNetworksDeleteInternalServerError handles this case with default header values. +/* PcloudVpnconnectionsNetworksDeleteInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -269,6 +278,9 @@ type PcloudVpnconnectionsNetworksDeleteInternalServerError struct { func (o *PcloudVpnconnectionsNetworksDeleteInternalServerError) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksDeleteInternalServerError %+v", 500, o.Payload) } +func (o *PcloudVpnconnectionsNetworksDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsNetworksDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_get_parameters.go b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_get_parameters.go index 929b6043..a09738cf 100644 --- a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_get_parameters.go +++ b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_get_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudVpnconnectionsNetworksGetParams creates a new PcloudVpnconnectionsNetworksGetParams object -// with the default values initialized. +// NewPcloudVpnconnectionsNetworksGetParams creates a new PcloudVpnconnectionsNetworksGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudVpnconnectionsNetworksGetParams() *PcloudVpnconnectionsNetworksGetParams { - var () return &PcloudVpnconnectionsNetworksGetParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudVpnconnectionsNetworksGetParamsWithTimeout creates a new PcloudVpnconnectionsNetworksGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudVpnconnectionsNetworksGetParamsWithTimeout(timeout time.Duration) *PcloudVpnconnectionsNetworksGetParams { - var () return &PcloudVpnconnectionsNetworksGetParams{ - timeout: timeout, } } // NewPcloudVpnconnectionsNetworksGetParamsWithContext creates a new PcloudVpnconnectionsNetworksGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudVpnconnectionsNetworksGetParamsWithContext(ctx context.Context) *PcloudVpnconnectionsNetworksGetParams { - var () return &PcloudVpnconnectionsNetworksGetParams{ - Context: ctx, } } // NewPcloudVpnconnectionsNetworksGetParamsWithHTTPClient creates a new PcloudVpnconnectionsNetworksGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudVpnconnectionsNetworksGetParamsWithHTTPClient(client *http.Client) *PcloudVpnconnectionsNetworksGetParams { - var () return &PcloudVpnconnectionsNetworksGetParams{ HTTPClient: client, } } -/*PcloudVpnconnectionsNetworksGetParams contains all the parameters to send to the API endpoint -for the pcloud vpnconnections networks get operation typically these are written to a http.Request +/* PcloudVpnconnectionsNetworksGetParams contains all the parameters to send to the API endpoint + for the pcloud vpnconnections networks get operation. + + Typically these are written to a http.Request. */ type PcloudVpnconnectionsNetworksGetParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*VpnConnectionID - ID of a VPN connection + /* VpnConnectionID. + + ID of a VPN connection */ VpnConnectionID string @@ -77,6 +76,21 @@ type PcloudVpnconnectionsNetworksGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud vpnconnections networks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsNetworksGetParams) WithDefaults() *PcloudVpnconnectionsNetworksGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud vpnconnections networks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsNetworksGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud vpnconnections networks get params func (o *PcloudVpnconnectionsNetworksGetParams) WithTimeout(timeout time.Duration) *PcloudVpnconnectionsNetworksGetParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_get_responses.go b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_get_responses.go index a51ca011..de86c27f 100644 --- a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_get_responses.go +++ b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudVpnconnectionsNetworksGetReader is a Reader for the PcloudVpnconnectionsNetworksGet structure. @@ -24,51 +23,44 @@ type PcloudVpnconnectionsNetworksGetReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudVpnconnectionsNetworksGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudVpnconnectionsNetworksGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudVpnconnectionsNetworksGetBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudVpnconnectionsNetworksGetUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 403: result := NewPcloudVpnconnectionsNetworksGetForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudVpnconnectionsNetworksGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudVpnconnectionsNetworksGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -77,21 +69,24 @@ func NewPcloudVpnconnectionsNetworksGetOK() *PcloudVpnconnectionsNetworksGetOK { return &PcloudVpnconnectionsNetworksGetOK{} } -/*PcloudVpnconnectionsNetworksGetOK handles this case with default header values. +/* PcloudVpnconnectionsNetworksGetOK describes a response with status code 200, with default header values. OK */ type PcloudVpnconnectionsNetworksGetOK struct { - Payload *models.NetworkIds + Payload *models.NetworkIDs } func (o *PcloudVpnconnectionsNetworksGetOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksGetOK %+v", 200, o.Payload) } +func (o *PcloudVpnconnectionsNetworksGetOK) GetPayload() *models.NetworkIDs { + return o.Payload +} func (o *PcloudVpnconnectionsNetworksGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - o.Payload = new(models.NetworkIds) + o.Payload = new(models.NetworkIDs) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { @@ -106,7 +101,7 @@ func NewPcloudVpnconnectionsNetworksGetBadRequest() *PcloudVpnconnectionsNetwork return &PcloudVpnconnectionsNetworksGetBadRequest{} } -/*PcloudVpnconnectionsNetworksGetBadRequest handles this case with default header values. +/* PcloudVpnconnectionsNetworksGetBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -117,6 +112,9 @@ type PcloudVpnconnectionsNetworksGetBadRequest struct { func (o *PcloudVpnconnectionsNetworksGetBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksGetBadRequest %+v", 400, o.Payload) } +func (o *PcloudVpnconnectionsNetworksGetBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsNetworksGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -135,7 +133,7 @@ func NewPcloudVpnconnectionsNetworksGetUnauthorized() *PcloudVpnconnectionsNetwo return &PcloudVpnconnectionsNetworksGetUnauthorized{} } -/*PcloudVpnconnectionsNetworksGetUnauthorized handles this case with default header values. +/* PcloudVpnconnectionsNetworksGetUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -146,6 +144,9 @@ type PcloudVpnconnectionsNetworksGetUnauthorized struct { func (o *PcloudVpnconnectionsNetworksGetUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksGetUnauthorized %+v", 401, o.Payload) } +func (o *PcloudVpnconnectionsNetworksGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsNetworksGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -164,7 +165,7 @@ func NewPcloudVpnconnectionsNetworksGetForbidden() *PcloudVpnconnectionsNetworks return &PcloudVpnconnectionsNetworksGetForbidden{} } -/*PcloudVpnconnectionsNetworksGetForbidden handles this case with default header values. +/* PcloudVpnconnectionsNetworksGetForbidden describes a response with status code 403, with default header values. Forbidden */ @@ -175,6 +176,9 @@ type PcloudVpnconnectionsNetworksGetForbidden struct { func (o *PcloudVpnconnectionsNetworksGetForbidden) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksGetForbidden %+v", 403, o.Payload) } +func (o *PcloudVpnconnectionsNetworksGetForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsNetworksGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -193,7 +197,7 @@ func NewPcloudVpnconnectionsNetworksGetNotFound() *PcloudVpnconnectionsNetworksG return &PcloudVpnconnectionsNetworksGetNotFound{} } -/*PcloudVpnconnectionsNetworksGetNotFound handles this case with default header values. +/* PcloudVpnconnectionsNetworksGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -204,6 +208,9 @@ type PcloudVpnconnectionsNetworksGetNotFound struct { func (o *PcloudVpnconnectionsNetworksGetNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksGetNotFound %+v", 404, o.Payload) } +func (o *PcloudVpnconnectionsNetworksGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsNetworksGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -222,7 +229,7 @@ func NewPcloudVpnconnectionsNetworksGetInternalServerError() *PcloudVpnconnectio return &PcloudVpnconnectionsNetworksGetInternalServerError{} } -/*PcloudVpnconnectionsNetworksGetInternalServerError handles this case with default header values. +/* PcloudVpnconnectionsNetworksGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -233,6 +240,9 @@ type PcloudVpnconnectionsNetworksGetInternalServerError struct { func (o *PcloudVpnconnectionsNetworksGetInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksGetInternalServerError %+v", 500, o.Payload) } +func (o *PcloudVpnconnectionsNetworksGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsNetworksGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_put_parameters.go b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_put_parameters.go index 8f07ac28..1cd48aa1 100644 --- a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_put_parameters.go +++ b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_put_parameters.go @@ -13,69 +13,69 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudVpnconnectionsNetworksPutParams creates a new PcloudVpnconnectionsNetworksPutParams object -// with the default values initialized. +// NewPcloudVpnconnectionsNetworksPutParams creates a new PcloudVpnconnectionsNetworksPutParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudVpnconnectionsNetworksPutParams() *PcloudVpnconnectionsNetworksPutParams { - var () return &PcloudVpnconnectionsNetworksPutParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudVpnconnectionsNetworksPutParamsWithTimeout creates a new PcloudVpnconnectionsNetworksPutParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudVpnconnectionsNetworksPutParamsWithTimeout(timeout time.Duration) *PcloudVpnconnectionsNetworksPutParams { - var () return &PcloudVpnconnectionsNetworksPutParams{ - timeout: timeout, } } // NewPcloudVpnconnectionsNetworksPutParamsWithContext creates a new PcloudVpnconnectionsNetworksPutParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudVpnconnectionsNetworksPutParamsWithContext(ctx context.Context) *PcloudVpnconnectionsNetworksPutParams { - var () return &PcloudVpnconnectionsNetworksPutParams{ - Context: ctx, } } // NewPcloudVpnconnectionsNetworksPutParamsWithHTTPClient creates a new PcloudVpnconnectionsNetworksPutParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudVpnconnectionsNetworksPutParamsWithHTTPClient(client *http.Client) *PcloudVpnconnectionsNetworksPutParams { - var () return &PcloudVpnconnectionsNetworksPutParams{ HTTPClient: client, } } -/*PcloudVpnconnectionsNetworksPutParams contains all the parameters to send to the API endpoint -for the pcloud vpnconnections networks put operation typically these are written to a http.Request +/* PcloudVpnconnectionsNetworksPutParams contains all the parameters to send to the API endpoint + for the pcloud vpnconnections networks put operation. + + Typically these are written to a http.Request. */ type PcloudVpnconnectionsNetworksPutParams struct { - /*Body - network to attach + /* Body. + network to attach */ Body *models.NetworkID - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*VpnConnectionID - ID of a VPN connection + /* VpnConnectionID. + + ID of a VPN connection */ VpnConnectionID string @@ -84,6 +84,21 @@ type PcloudVpnconnectionsNetworksPutParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud vpnconnections networks put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsNetworksPutParams) WithDefaults() *PcloudVpnconnectionsNetworksPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud vpnconnections networks put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsNetworksPutParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud vpnconnections networks put params func (o *PcloudVpnconnectionsNetworksPutParams) WithTimeout(timeout time.Duration) *PcloudVpnconnectionsNetworksPutParams { o.SetTimeout(timeout) @@ -157,7 +172,6 @@ func (o *PcloudVpnconnectionsNetworksPutParams) WriteToRequest(r runtime.ClientR return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_put_responses.go b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_put_responses.go index 91d7829e..4bcc8502 100644 --- a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_put_responses.go +++ b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_put_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudVpnconnectionsNetworksPutReader is a Reader for the PcloudVpnconnectionsNetworksPut structure. @@ -24,58 +23,50 @@ type PcloudVpnconnectionsNetworksPutReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudVpnconnectionsNetworksPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 202: result := NewPcloudVpnconnectionsNetworksPutAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudVpnconnectionsNetworksPutBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudVpnconnectionsNetworksPutUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 403: result := NewPcloudVpnconnectionsNetworksPutForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudVpnconnectionsNetworksPutNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudVpnconnectionsNetworksPutUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudVpnconnectionsNetworksPutInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -84,7 +75,7 @@ func NewPcloudVpnconnectionsNetworksPutAccepted() *PcloudVpnconnectionsNetworksP return &PcloudVpnconnectionsNetworksPutAccepted{} } -/*PcloudVpnconnectionsNetworksPutAccepted handles this case with default header values. +/* PcloudVpnconnectionsNetworksPutAccepted describes a response with status code 202, with default header values. Accepted */ @@ -95,6 +86,9 @@ type PcloudVpnconnectionsNetworksPutAccepted struct { func (o *PcloudVpnconnectionsNetworksPutAccepted) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksPutAccepted %+v", 202, o.Payload) } +func (o *PcloudVpnconnectionsNetworksPutAccepted) GetPayload() *models.JobReference { + return o.Payload +} func (o *PcloudVpnconnectionsNetworksPutAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -113,7 +107,7 @@ func NewPcloudVpnconnectionsNetworksPutBadRequest() *PcloudVpnconnectionsNetwork return &PcloudVpnconnectionsNetworksPutBadRequest{} } -/*PcloudVpnconnectionsNetworksPutBadRequest handles this case with default header values. +/* PcloudVpnconnectionsNetworksPutBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -124,6 +118,9 @@ type PcloudVpnconnectionsNetworksPutBadRequest struct { func (o *PcloudVpnconnectionsNetworksPutBadRequest) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksPutBadRequest %+v", 400, o.Payload) } +func (o *PcloudVpnconnectionsNetworksPutBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsNetworksPutBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -142,7 +139,7 @@ func NewPcloudVpnconnectionsNetworksPutUnauthorized() *PcloudVpnconnectionsNetwo return &PcloudVpnconnectionsNetworksPutUnauthorized{} } -/*PcloudVpnconnectionsNetworksPutUnauthorized handles this case with default header values. +/* PcloudVpnconnectionsNetworksPutUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -153,6 +150,9 @@ type PcloudVpnconnectionsNetworksPutUnauthorized struct { func (o *PcloudVpnconnectionsNetworksPutUnauthorized) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksPutUnauthorized %+v", 401, o.Payload) } +func (o *PcloudVpnconnectionsNetworksPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsNetworksPutUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -171,7 +171,7 @@ func NewPcloudVpnconnectionsNetworksPutForbidden() *PcloudVpnconnectionsNetworks return &PcloudVpnconnectionsNetworksPutForbidden{} } -/*PcloudVpnconnectionsNetworksPutForbidden handles this case with default header values. +/* PcloudVpnconnectionsNetworksPutForbidden describes a response with status code 403, with default header values. Forbidden */ @@ -182,6 +182,9 @@ type PcloudVpnconnectionsNetworksPutForbidden struct { func (o *PcloudVpnconnectionsNetworksPutForbidden) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksPutForbidden %+v", 403, o.Payload) } +func (o *PcloudVpnconnectionsNetworksPutForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsNetworksPutForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -200,7 +203,7 @@ func NewPcloudVpnconnectionsNetworksPutNotFound() *PcloudVpnconnectionsNetworksP return &PcloudVpnconnectionsNetworksPutNotFound{} } -/*PcloudVpnconnectionsNetworksPutNotFound handles this case with default header values. +/* PcloudVpnconnectionsNetworksPutNotFound describes a response with status code 404, with default header values. Not Found */ @@ -211,6 +214,9 @@ type PcloudVpnconnectionsNetworksPutNotFound struct { func (o *PcloudVpnconnectionsNetworksPutNotFound) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksPutNotFound %+v", 404, o.Payload) } +func (o *PcloudVpnconnectionsNetworksPutNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsNetworksPutNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -229,7 +235,7 @@ func NewPcloudVpnconnectionsNetworksPutUnprocessableEntity() *PcloudVpnconnectio return &PcloudVpnconnectionsNetworksPutUnprocessableEntity{} } -/*PcloudVpnconnectionsNetworksPutUnprocessableEntity handles this case with default header values. +/* PcloudVpnconnectionsNetworksPutUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -240,6 +246,9 @@ type PcloudVpnconnectionsNetworksPutUnprocessableEntity struct { func (o *PcloudVpnconnectionsNetworksPutUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksPutUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudVpnconnectionsNetworksPutUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsNetworksPutUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -258,7 +267,7 @@ func NewPcloudVpnconnectionsNetworksPutInternalServerError() *PcloudVpnconnectio return &PcloudVpnconnectionsNetworksPutInternalServerError{} } -/*PcloudVpnconnectionsNetworksPutInternalServerError handles this case with default header values. +/* PcloudVpnconnectionsNetworksPutInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -269,6 +278,9 @@ type PcloudVpnconnectionsNetworksPutInternalServerError struct { func (o *PcloudVpnconnectionsNetworksPutInternalServerError) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksPutInternalServerError %+v", 500, o.Payload) } +func (o *PcloudVpnconnectionsNetworksPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsNetworksPutInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_delete_parameters.go b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_delete_parameters.go index 8c154c31..5834aeab 100644 --- a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_delete_parameters.go +++ b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_delete_parameters.go @@ -13,69 +13,69 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudVpnconnectionsPeersubnetsDeleteParams creates a new PcloudVpnconnectionsPeersubnetsDeleteParams object -// with the default values initialized. +// NewPcloudVpnconnectionsPeersubnetsDeleteParams creates a new PcloudVpnconnectionsPeersubnetsDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudVpnconnectionsPeersubnetsDeleteParams() *PcloudVpnconnectionsPeersubnetsDeleteParams { - var () return &PcloudVpnconnectionsPeersubnetsDeleteParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudVpnconnectionsPeersubnetsDeleteParamsWithTimeout creates a new PcloudVpnconnectionsPeersubnetsDeleteParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudVpnconnectionsPeersubnetsDeleteParamsWithTimeout(timeout time.Duration) *PcloudVpnconnectionsPeersubnetsDeleteParams { - var () return &PcloudVpnconnectionsPeersubnetsDeleteParams{ - timeout: timeout, } } // NewPcloudVpnconnectionsPeersubnetsDeleteParamsWithContext creates a new PcloudVpnconnectionsPeersubnetsDeleteParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudVpnconnectionsPeersubnetsDeleteParamsWithContext(ctx context.Context) *PcloudVpnconnectionsPeersubnetsDeleteParams { - var () return &PcloudVpnconnectionsPeersubnetsDeleteParams{ - Context: ctx, } } // NewPcloudVpnconnectionsPeersubnetsDeleteParamsWithHTTPClient creates a new PcloudVpnconnectionsPeersubnetsDeleteParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudVpnconnectionsPeersubnetsDeleteParamsWithHTTPClient(client *http.Client) *PcloudVpnconnectionsPeersubnetsDeleteParams { - var () return &PcloudVpnconnectionsPeersubnetsDeleteParams{ HTTPClient: client, } } -/*PcloudVpnconnectionsPeersubnetsDeleteParams contains all the parameters to send to the API endpoint -for the pcloud vpnconnections peersubnets delete operation typically these are written to a http.Request +/* PcloudVpnconnectionsPeersubnetsDeleteParams contains all the parameters to send to the API endpoint + for the pcloud vpnconnections peersubnets delete operation. + + Typically these are written to a http.Request. */ type PcloudVpnconnectionsPeersubnetsDeleteParams struct { - /*Body - Peer subnet to detach + /* Body. + Peer subnet to detach */ Body *models.PeerSubnetUpdate - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*VpnConnectionID - ID of a VPN connection + /* VpnConnectionID. + + ID of a VPN connection */ VpnConnectionID string @@ -84,6 +84,21 @@ type PcloudVpnconnectionsPeersubnetsDeleteParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud vpnconnections peersubnets delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsPeersubnetsDeleteParams) WithDefaults() *PcloudVpnconnectionsPeersubnetsDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud vpnconnections peersubnets delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsPeersubnetsDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud vpnconnections peersubnets delete params func (o *PcloudVpnconnectionsPeersubnetsDeleteParams) WithTimeout(timeout time.Duration) *PcloudVpnconnectionsPeersubnetsDeleteParams { o.SetTimeout(timeout) @@ -157,7 +172,6 @@ func (o *PcloudVpnconnectionsPeersubnetsDeleteParams) WriteToRequest(r runtime.C return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_delete_responses.go b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_delete_responses.go index ce88e1a5..5b6d05ba 100644 --- a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_delete_responses.go +++ b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_delete_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudVpnconnectionsPeersubnetsDeleteReader is a Reader for the PcloudVpnconnectionsPeersubnetsDelete structure. @@ -24,51 +23,44 @@ type PcloudVpnconnectionsPeersubnetsDeleteReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudVpnconnectionsPeersubnetsDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudVpnconnectionsPeersubnetsDeleteOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudVpnconnectionsPeersubnetsDeleteBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudVpnconnectionsPeersubnetsDeleteUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 403: result := NewPcloudVpnconnectionsPeersubnetsDeleteForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudVpnconnectionsPeersubnetsDeleteUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudVpnconnectionsPeersubnetsDeleteInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -77,7 +69,7 @@ func NewPcloudVpnconnectionsPeersubnetsDeleteOK() *PcloudVpnconnectionsPeersubne return &PcloudVpnconnectionsPeersubnetsDeleteOK{} } -/*PcloudVpnconnectionsPeersubnetsDeleteOK handles this case with default header values. +/* PcloudVpnconnectionsPeersubnetsDeleteOK describes a response with status code 200, with default header values. OK */ @@ -88,6 +80,9 @@ type PcloudVpnconnectionsPeersubnetsDeleteOK struct { func (o *PcloudVpnconnectionsPeersubnetsDeleteOK) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsDeleteOK %+v", 200, o.Payload) } +func (o *PcloudVpnconnectionsPeersubnetsDeleteOK) GetPayload() *models.PeerSubnets { + return o.Payload +} func (o *PcloudVpnconnectionsPeersubnetsDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -106,7 +101,7 @@ func NewPcloudVpnconnectionsPeersubnetsDeleteBadRequest() *PcloudVpnconnectionsP return &PcloudVpnconnectionsPeersubnetsDeleteBadRequest{} } -/*PcloudVpnconnectionsPeersubnetsDeleteBadRequest handles this case with default header values. +/* PcloudVpnconnectionsPeersubnetsDeleteBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -117,6 +112,9 @@ type PcloudVpnconnectionsPeersubnetsDeleteBadRequest struct { func (o *PcloudVpnconnectionsPeersubnetsDeleteBadRequest) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsDeleteBadRequest %+v", 400, o.Payload) } +func (o *PcloudVpnconnectionsPeersubnetsDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsPeersubnetsDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -135,7 +133,7 @@ func NewPcloudVpnconnectionsPeersubnetsDeleteUnauthorized() *PcloudVpnconnection return &PcloudVpnconnectionsPeersubnetsDeleteUnauthorized{} } -/*PcloudVpnconnectionsPeersubnetsDeleteUnauthorized handles this case with default header values. +/* PcloudVpnconnectionsPeersubnetsDeleteUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -146,6 +144,9 @@ type PcloudVpnconnectionsPeersubnetsDeleteUnauthorized struct { func (o *PcloudVpnconnectionsPeersubnetsDeleteUnauthorized) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsDeleteUnauthorized %+v", 401, o.Payload) } +func (o *PcloudVpnconnectionsPeersubnetsDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsPeersubnetsDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -164,7 +165,7 @@ func NewPcloudVpnconnectionsPeersubnetsDeleteForbidden() *PcloudVpnconnectionsPe return &PcloudVpnconnectionsPeersubnetsDeleteForbidden{} } -/*PcloudVpnconnectionsPeersubnetsDeleteForbidden handles this case with default header values. +/* PcloudVpnconnectionsPeersubnetsDeleteForbidden describes a response with status code 403, with default header values. Forbidden */ @@ -175,6 +176,9 @@ type PcloudVpnconnectionsPeersubnetsDeleteForbidden struct { func (o *PcloudVpnconnectionsPeersubnetsDeleteForbidden) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsDeleteForbidden %+v", 403, o.Payload) } +func (o *PcloudVpnconnectionsPeersubnetsDeleteForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsPeersubnetsDeleteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -193,7 +197,7 @@ func NewPcloudVpnconnectionsPeersubnetsDeleteUnprocessableEntity() *PcloudVpncon return &PcloudVpnconnectionsPeersubnetsDeleteUnprocessableEntity{} } -/*PcloudVpnconnectionsPeersubnetsDeleteUnprocessableEntity handles this case with default header values. +/* PcloudVpnconnectionsPeersubnetsDeleteUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -204,6 +208,9 @@ type PcloudVpnconnectionsPeersubnetsDeleteUnprocessableEntity struct { func (o *PcloudVpnconnectionsPeersubnetsDeleteUnprocessableEntity) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsDeleteUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudVpnconnectionsPeersubnetsDeleteUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsPeersubnetsDeleteUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -222,7 +229,7 @@ func NewPcloudVpnconnectionsPeersubnetsDeleteInternalServerError() *PcloudVpncon return &PcloudVpnconnectionsPeersubnetsDeleteInternalServerError{} } -/*PcloudVpnconnectionsPeersubnetsDeleteInternalServerError handles this case with default header values. +/* PcloudVpnconnectionsPeersubnetsDeleteInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -233,6 +240,9 @@ type PcloudVpnconnectionsPeersubnetsDeleteInternalServerError struct { func (o *PcloudVpnconnectionsPeersubnetsDeleteInternalServerError) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsDeleteInternalServerError %+v", 500, o.Payload) } +func (o *PcloudVpnconnectionsPeersubnetsDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsPeersubnetsDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_get_parameters.go b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_get_parameters.go index f31225d7..d17411fd 100644 --- a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_get_parameters.go +++ b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_get_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudVpnconnectionsPeersubnetsGetParams creates a new PcloudVpnconnectionsPeersubnetsGetParams object -// with the default values initialized. +// NewPcloudVpnconnectionsPeersubnetsGetParams creates a new PcloudVpnconnectionsPeersubnetsGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudVpnconnectionsPeersubnetsGetParams() *PcloudVpnconnectionsPeersubnetsGetParams { - var () return &PcloudVpnconnectionsPeersubnetsGetParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudVpnconnectionsPeersubnetsGetParamsWithTimeout creates a new PcloudVpnconnectionsPeersubnetsGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudVpnconnectionsPeersubnetsGetParamsWithTimeout(timeout time.Duration) *PcloudVpnconnectionsPeersubnetsGetParams { - var () return &PcloudVpnconnectionsPeersubnetsGetParams{ - timeout: timeout, } } // NewPcloudVpnconnectionsPeersubnetsGetParamsWithContext creates a new PcloudVpnconnectionsPeersubnetsGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudVpnconnectionsPeersubnetsGetParamsWithContext(ctx context.Context) *PcloudVpnconnectionsPeersubnetsGetParams { - var () return &PcloudVpnconnectionsPeersubnetsGetParams{ - Context: ctx, } } // NewPcloudVpnconnectionsPeersubnetsGetParamsWithHTTPClient creates a new PcloudVpnconnectionsPeersubnetsGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudVpnconnectionsPeersubnetsGetParamsWithHTTPClient(client *http.Client) *PcloudVpnconnectionsPeersubnetsGetParams { - var () return &PcloudVpnconnectionsPeersubnetsGetParams{ HTTPClient: client, } } -/*PcloudVpnconnectionsPeersubnetsGetParams contains all the parameters to send to the API endpoint -for the pcloud vpnconnections peersubnets get operation typically these are written to a http.Request +/* PcloudVpnconnectionsPeersubnetsGetParams contains all the parameters to send to the API endpoint + for the pcloud vpnconnections peersubnets get operation. + + Typically these are written to a http.Request. */ type PcloudVpnconnectionsPeersubnetsGetParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*VpnConnectionID - ID of a VPN connection + /* VpnConnectionID. + + ID of a VPN connection */ VpnConnectionID string @@ -77,6 +76,21 @@ type PcloudVpnconnectionsPeersubnetsGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud vpnconnections peersubnets get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsPeersubnetsGetParams) WithDefaults() *PcloudVpnconnectionsPeersubnetsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud vpnconnections peersubnets get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsPeersubnetsGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud vpnconnections peersubnets get params func (o *PcloudVpnconnectionsPeersubnetsGetParams) WithTimeout(timeout time.Duration) *PcloudVpnconnectionsPeersubnetsGetParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_get_responses.go b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_get_responses.go index 2ee86a0a..6f9e64ef 100644 --- a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_get_responses.go +++ b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudVpnconnectionsPeersubnetsGetReader is a Reader for the PcloudVpnconnectionsPeersubnetsGet structure. @@ -24,51 +23,44 @@ type PcloudVpnconnectionsPeersubnetsGetReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudVpnconnectionsPeersubnetsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudVpnconnectionsPeersubnetsGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudVpnconnectionsPeersubnetsGetBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudVpnconnectionsPeersubnetsGetUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 403: result := NewPcloudVpnconnectionsPeersubnetsGetForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudVpnconnectionsPeersubnetsGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudVpnconnectionsPeersubnetsGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -77,7 +69,7 @@ func NewPcloudVpnconnectionsPeersubnetsGetOK() *PcloudVpnconnectionsPeersubnetsG return &PcloudVpnconnectionsPeersubnetsGetOK{} } -/*PcloudVpnconnectionsPeersubnetsGetOK handles this case with default header values. +/* PcloudVpnconnectionsPeersubnetsGetOK describes a response with status code 200, with default header values. OK */ @@ -88,6 +80,9 @@ type PcloudVpnconnectionsPeersubnetsGetOK struct { func (o *PcloudVpnconnectionsPeersubnetsGetOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsGetOK %+v", 200, o.Payload) } +func (o *PcloudVpnconnectionsPeersubnetsGetOK) GetPayload() *models.PeerSubnets { + return o.Payload +} func (o *PcloudVpnconnectionsPeersubnetsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -106,7 +101,7 @@ func NewPcloudVpnconnectionsPeersubnetsGetBadRequest() *PcloudVpnconnectionsPeer return &PcloudVpnconnectionsPeersubnetsGetBadRequest{} } -/*PcloudVpnconnectionsPeersubnetsGetBadRequest handles this case with default header values. +/* PcloudVpnconnectionsPeersubnetsGetBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -117,6 +112,9 @@ type PcloudVpnconnectionsPeersubnetsGetBadRequest struct { func (o *PcloudVpnconnectionsPeersubnetsGetBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsGetBadRequest %+v", 400, o.Payload) } +func (o *PcloudVpnconnectionsPeersubnetsGetBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsPeersubnetsGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -135,7 +133,7 @@ func NewPcloudVpnconnectionsPeersubnetsGetUnauthorized() *PcloudVpnconnectionsPe return &PcloudVpnconnectionsPeersubnetsGetUnauthorized{} } -/*PcloudVpnconnectionsPeersubnetsGetUnauthorized handles this case with default header values. +/* PcloudVpnconnectionsPeersubnetsGetUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -146,6 +144,9 @@ type PcloudVpnconnectionsPeersubnetsGetUnauthorized struct { func (o *PcloudVpnconnectionsPeersubnetsGetUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsGetUnauthorized %+v", 401, o.Payload) } +func (o *PcloudVpnconnectionsPeersubnetsGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsPeersubnetsGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -164,7 +165,7 @@ func NewPcloudVpnconnectionsPeersubnetsGetForbidden() *PcloudVpnconnectionsPeers return &PcloudVpnconnectionsPeersubnetsGetForbidden{} } -/*PcloudVpnconnectionsPeersubnetsGetForbidden handles this case with default header values. +/* PcloudVpnconnectionsPeersubnetsGetForbidden describes a response with status code 403, with default header values. Forbidden */ @@ -175,6 +176,9 @@ type PcloudVpnconnectionsPeersubnetsGetForbidden struct { func (o *PcloudVpnconnectionsPeersubnetsGetForbidden) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsGetForbidden %+v", 403, o.Payload) } +func (o *PcloudVpnconnectionsPeersubnetsGetForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsPeersubnetsGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -193,7 +197,7 @@ func NewPcloudVpnconnectionsPeersubnetsGetNotFound() *PcloudVpnconnectionsPeersu return &PcloudVpnconnectionsPeersubnetsGetNotFound{} } -/*PcloudVpnconnectionsPeersubnetsGetNotFound handles this case with default header values. +/* PcloudVpnconnectionsPeersubnetsGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -204,6 +208,9 @@ type PcloudVpnconnectionsPeersubnetsGetNotFound struct { func (o *PcloudVpnconnectionsPeersubnetsGetNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsGetNotFound %+v", 404, o.Payload) } +func (o *PcloudVpnconnectionsPeersubnetsGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsPeersubnetsGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -222,7 +229,7 @@ func NewPcloudVpnconnectionsPeersubnetsGetInternalServerError() *PcloudVpnconnec return &PcloudVpnconnectionsPeersubnetsGetInternalServerError{} } -/*PcloudVpnconnectionsPeersubnetsGetInternalServerError handles this case with default header values. +/* PcloudVpnconnectionsPeersubnetsGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -233,6 +240,9 @@ type PcloudVpnconnectionsPeersubnetsGetInternalServerError struct { func (o *PcloudVpnconnectionsPeersubnetsGetInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsGetInternalServerError %+v", 500, o.Payload) } +func (o *PcloudVpnconnectionsPeersubnetsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsPeersubnetsGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_put_parameters.go b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_put_parameters.go index 4a173ea2..0f74fcc1 100644 --- a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_put_parameters.go +++ b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_put_parameters.go @@ -13,69 +13,69 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudVpnconnectionsPeersubnetsPutParams creates a new PcloudVpnconnectionsPeersubnetsPutParams object -// with the default values initialized. +// NewPcloudVpnconnectionsPeersubnetsPutParams creates a new PcloudVpnconnectionsPeersubnetsPutParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudVpnconnectionsPeersubnetsPutParams() *PcloudVpnconnectionsPeersubnetsPutParams { - var () return &PcloudVpnconnectionsPeersubnetsPutParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudVpnconnectionsPeersubnetsPutParamsWithTimeout creates a new PcloudVpnconnectionsPeersubnetsPutParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudVpnconnectionsPeersubnetsPutParamsWithTimeout(timeout time.Duration) *PcloudVpnconnectionsPeersubnetsPutParams { - var () return &PcloudVpnconnectionsPeersubnetsPutParams{ - timeout: timeout, } } // NewPcloudVpnconnectionsPeersubnetsPutParamsWithContext creates a new PcloudVpnconnectionsPeersubnetsPutParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudVpnconnectionsPeersubnetsPutParamsWithContext(ctx context.Context) *PcloudVpnconnectionsPeersubnetsPutParams { - var () return &PcloudVpnconnectionsPeersubnetsPutParams{ - Context: ctx, } } // NewPcloudVpnconnectionsPeersubnetsPutParamsWithHTTPClient creates a new PcloudVpnconnectionsPeersubnetsPutParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudVpnconnectionsPeersubnetsPutParamsWithHTTPClient(client *http.Client) *PcloudVpnconnectionsPeersubnetsPutParams { - var () return &PcloudVpnconnectionsPeersubnetsPutParams{ HTTPClient: client, } } -/*PcloudVpnconnectionsPeersubnetsPutParams contains all the parameters to send to the API endpoint -for the pcloud vpnconnections peersubnets put operation typically these are written to a http.Request +/* PcloudVpnconnectionsPeersubnetsPutParams contains all the parameters to send to the API endpoint + for the pcloud vpnconnections peersubnets put operation. + + Typically these are written to a http.Request. */ type PcloudVpnconnectionsPeersubnetsPutParams struct { - /*Body - peer subnet to attach + /* Body. + peer subnet to attach */ Body *models.PeerSubnetUpdate - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*VpnConnectionID - ID of a VPN connection + /* VpnConnectionID. + + ID of a VPN connection */ VpnConnectionID string @@ -84,6 +84,21 @@ type PcloudVpnconnectionsPeersubnetsPutParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud vpnconnections peersubnets put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsPeersubnetsPutParams) WithDefaults() *PcloudVpnconnectionsPeersubnetsPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud vpnconnections peersubnets put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsPeersubnetsPutParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud vpnconnections peersubnets put params func (o *PcloudVpnconnectionsPeersubnetsPutParams) WithTimeout(timeout time.Duration) *PcloudVpnconnectionsPeersubnetsPutParams { o.SetTimeout(timeout) @@ -157,7 +172,6 @@ func (o *PcloudVpnconnectionsPeersubnetsPutParams) WriteToRequest(r runtime.Clie return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_put_responses.go b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_put_responses.go index bd1a21d3..a9967c9a 100644 --- a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_put_responses.go +++ b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_put_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudVpnconnectionsPeersubnetsPutReader is a Reader for the PcloudVpnconnectionsPeersubnetsPut structure. @@ -24,51 +23,44 @@ type PcloudVpnconnectionsPeersubnetsPutReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudVpnconnectionsPeersubnetsPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudVpnconnectionsPeersubnetsPutOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudVpnconnectionsPeersubnetsPutBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudVpnconnectionsPeersubnetsPutUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 403: result := NewPcloudVpnconnectionsPeersubnetsPutForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudVpnconnectionsPeersubnetsPutUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudVpnconnectionsPeersubnetsPutInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -77,7 +69,7 @@ func NewPcloudVpnconnectionsPeersubnetsPutOK() *PcloudVpnconnectionsPeersubnetsP return &PcloudVpnconnectionsPeersubnetsPutOK{} } -/*PcloudVpnconnectionsPeersubnetsPutOK handles this case with default header values. +/* PcloudVpnconnectionsPeersubnetsPutOK describes a response with status code 200, with default header values. OK */ @@ -88,6 +80,9 @@ type PcloudVpnconnectionsPeersubnetsPutOK struct { func (o *PcloudVpnconnectionsPeersubnetsPutOK) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsPutOK %+v", 200, o.Payload) } +func (o *PcloudVpnconnectionsPeersubnetsPutOK) GetPayload() *models.PeerSubnets { + return o.Payload +} func (o *PcloudVpnconnectionsPeersubnetsPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -106,7 +101,7 @@ func NewPcloudVpnconnectionsPeersubnetsPutBadRequest() *PcloudVpnconnectionsPeer return &PcloudVpnconnectionsPeersubnetsPutBadRequest{} } -/*PcloudVpnconnectionsPeersubnetsPutBadRequest handles this case with default header values. +/* PcloudVpnconnectionsPeersubnetsPutBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -117,6 +112,9 @@ type PcloudVpnconnectionsPeersubnetsPutBadRequest struct { func (o *PcloudVpnconnectionsPeersubnetsPutBadRequest) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsPutBadRequest %+v", 400, o.Payload) } +func (o *PcloudVpnconnectionsPeersubnetsPutBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsPeersubnetsPutBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -135,7 +133,7 @@ func NewPcloudVpnconnectionsPeersubnetsPutUnauthorized() *PcloudVpnconnectionsPe return &PcloudVpnconnectionsPeersubnetsPutUnauthorized{} } -/*PcloudVpnconnectionsPeersubnetsPutUnauthorized handles this case with default header values. +/* PcloudVpnconnectionsPeersubnetsPutUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -146,6 +144,9 @@ type PcloudVpnconnectionsPeersubnetsPutUnauthorized struct { func (o *PcloudVpnconnectionsPeersubnetsPutUnauthorized) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsPutUnauthorized %+v", 401, o.Payload) } +func (o *PcloudVpnconnectionsPeersubnetsPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsPeersubnetsPutUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -164,7 +165,7 @@ func NewPcloudVpnconnectionsPeersubnetsPutForbidden() *PcloudVpnconnectionsPeers return &PcloudVpnconnectionsPeersubnetsPutForbidden{} } -/*PcloudVpnconnectionsPeersubnetsPutForbidden handles this case with default header values. +/* PcloudVpnconnectionsPeersubnetsPutForbidden describes a response with status code 403, with default header values. Forbidden */ @@ -175,6 +176,9 @@ type PcloudVpnconnectionsPeersubnetsPutForbidden struct { func (o *PcloudVpnconnectionsPeersubnetsPutForbidden) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsPutForbidden %+v", 403, o.Payload) } +func (o *PcloudVpnconnectionsPeersubnetsPutForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsPeersubnetsPutForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -193,7 +197,7 @@ func NewPcloudVpnconnectionsPeersubnetsPutUnprocessableEntity() *PcloudVpnconnec return &PcloudVpnconnectionsPeersubnetsPutUnprocessableEntity{} } -/*PcloudVpnconnectionsPeersubnetsPutUnprocessableEntity handles this case with default header values. +/* PcloudVpnconnectionsPeersubnetsPutUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -204,6 +208,9 @@ type PcloudVpnconnectionsPeersubnetsPutUnprocessableEntity struct { func (o *PcloudVpnconnectionsPeersubnetsPutUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsPutUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudVpnconnectionsPeersubnetsPutUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsPeersubnetsPutUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -222,7 +229,7 @@ func NewPcloudVpnconnectionsPeersubnetsPutInternalServerError() *PcloudVpnconnec return &PcloudVpnconnectionsPeersubnetsPutInternalServerError{} } -/*PcloudVpnconnectionsPeersubnetsPutInternalServerError handles this case with default header values. +/* PcloudVpnconnectionsPeersubnetsPutInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -233,6 +240,9 @@ type PcloudVpnconnectionsPeersubnetsPutInternalServerError struct { func (o *PcloudVpnconnectionsPeersubnetsPutInternalServerError) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsPutInternalServerError %+v", 500, o.Payload) } +func (o *PcloudVpnconnectionsPeersubnetsPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsPeersubnetsPutInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_post_parameters.go b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_post_parameters.go index b71fbcb5..0c101621 100644 --- a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_post_parameters.go +++ b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_post_parameters.go @@ -13,64 +13,63 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudVpnconnectionsPostParams creates a new PcloudVpnconnectionsPostParams object -// with the default values initialized. +// NewPcloudVpnconnectionsPostParams creates a new PcloudVpnconnectionsPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudVpnconnectionsPostParams() *PcloudVpnconnectionsPostParams { - var () return &PcloudVpnconnectionsPostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudVpnconnectionsPostParamsWithTimeout creates a new PcloudVpnconnectionsPostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudVpnconnectionsPostParamsWithTimeout(timeout time.Duration) *PcloudVpnconnectionsPostParams { - var () return &PcloudVpnconnectionsPostParams{ - timeout: timeout, } } // NewPcloudVpnconnectionsPostParamsWithContext creates a new PcloudVpnconnectionsPostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudVpnconnectionsPostParamsWithContext(ctx context.Context) *PcloudVpnconnectionsPostParams { - var () return &PcloudVpnconnectionsPostParams{ - Context: ctx, } } // NewPcloudVpnconnectionsPostParamsWithHTTPClient creates a new PcloudVpnconnectionsPostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudVpnconnectionsPostParamsWithHTTPClient(client *http.Client) *PcloudVpnconnectionsPostParams { - var () return &PcloudVpnconnectionsPostParams{ HTTPClient: client, } } -/*PcloudVpnconnectionsPostParams contains all the parameters to send to the API endpoint -for the pcloud vpnconnections post operation typically these are written to a http.Request +/* PcloudVpnconnectionsPostParams contains all the parameters to send to the API endpoint + for the pcloud vpnconnections post operation. + + Typically these are written to a http.Request. */ type PcloudVpnconnectionsPostParams struct { - /*Body - VPN Connection object used for creation + /* Body. + VPN Connection object used for creation */ Body *models.VPNConnectionCreate - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -79,6 +78,21 @@ type PcloudVpnconnectionsPostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud vpnconnections post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsPostParams) WithDefaults() *PcloudVpnconnectionsPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud vpnconnections post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsPostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud vpnconnections post params func (o *PcloudVpnconnectionsPostParams) WithTimeout(timeout time.Duration) *PcloudVpnconnectionsPostParams { o.SetTimeout(timeout) @@ -141,7 +155,6 @@ func (o *PcloudVpnconnectionsPostParams) WriteToRequest(r runtime.ClientRequest, return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_post_responses.go b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_post_responses.go index bd6f2de9..c4f1f0a6 100644 --- a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_post_responses.go +++ b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudVpnconnectionsPostReader is a Reader for the PcloudVpnconnectionsPost structure. @@ -24,58 +23,50 @@ type PcloudVpnconnectionsPostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudVpnconnectionsPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 202: result := NewPcloudVpnconnectionsPostAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudVpnconnectionsPostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudVpnconnectionsPostUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 403: result := NewPcloudVpnconnectionsPostForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 409: result := NewPcloudVpnconnectionsPostConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudVpnconnectionsPostUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudVpnconnectionsPostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -84,7 +75,7 @@ func NewPcloudVpnconnectionsPostAccepted() *PcloudVpnconnectionsPostAccepted { return &PcloudVpnconnectionsPostAccepted{} } -/*PcloudVpnconnectionsPostAccepted handles this case with default header values. +/* PcloudVpnconnectionsPostAccepted describes a response with status code 202, with default header values. Accepted */ @@ -95,6 +86,9 @@ type PcloudVpnconnectionsPostAccepted struct { func (o *PcloudVpnconnectionsPostAccepted) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections][%d] pcloudVpnconnectionsPostAccepted %+v", 202, o.Payload) } +func (o *PcloudVpnconnectionsPostAccepted) GetPayload() *models.VPNConnectionCreateResponse { + return o.Payload +} func (o *PcloudVpnconnectionsPostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -113,7 +107,7 @@ func NewPcloudVpnconnectionsPostBadRequest() *PcloudVpnconnectionsPostBadRequest return &PcloudVpnconnectionsPostBadRequest{} } -/*PcloudVpnconnectionsPostBadRequest handles this case with default header values. +/* PcloudVpnconnectionsPostBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -124,6 +118,9 @@ type PcloudVpnconnectionsPostBadRequest struct { func (o *PcloudVpnconnectionsPostBadRequest) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections][%d] pcloudVpnconnectionsPostBadRequest %+v", 400, o.Payload) } +func (o *PcloudVpnconnectionsPostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -142,7 +139,7 @@ func NewPcloudVpnconnectionsPostUnauthorized() *PcloudVpnconnectionsPostUnauthor return &PcloudVpnconnectionsPostUnauthorized{} } -/*PcloudVpnconnectionsPostUnauthorized handles this case with default header values. +/* PcloudVpnconnectionsPostUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -153,6 +150,9 @@ type PcloudVpnconnectionsPostUnauthorized struct { func (o *PcloudVpnconnectionsPostUnauthorized) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections][%d] pcloudVpnconnectionsPostUnauthorized %+v", 401, o.Payload) } +func (o *PcloudVpnconnectionsPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -171,7 +171,7 @@ func NewPcloudVpnconnectionsPostForbidden() *PcloudVpnconnectionsPostForbidden { return &PcloudVpnconnectionsPostForbidden{} } -/*PcloudVpnconnectionsPostForbidden handles this case with default header values. +/* PcloudVpnconnectionsPostForbidden describes a response with status code 403, with default header values. Forbidden */ @@ -182,6 +182,9 @@ type PcloudVpnconnectionsPostForbidden struct { func (o *PcloudVpnconnectionsPostForbidden) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections][%d] pcloudVpnconnectionsPostForbidden %+v", 403, o.Payload) } +func (o *PcloudVpnconnectionsPostForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsPostForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -200,7 +203,7 @@ func NewPcloudVpnconnectionsPostConflict() *PcloudVpnconnectionsPostConflict { return &PcloudVpnconnectionsPostConflict{} } -/*PcloudVpnconnectionsPostConflict handles this case with default header values. +/* PcloudVpnconnectionsPostConflict describes a response with status code 409, with default header values. Conflict */ @@ -211,6 +214,9 @@ type PcloudVpnconnectionsPostConflict struct { func (o *PcloudVpnconnectionsPostConflict) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections][%d] pcloudVpnconnectionsPostConflict %+v", 409, o.Payload) } +func (o *PcloudVpnconnectionsPostConflict) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsPostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -229,7 +235,7 @@ func NewPcloudVpnconnectionsPostUnprocessableEntity() *PcloudVpnconnectionsPostU return &PcloudVpnconnectionsPostUnprocessableEntity{} } -/*PcloudVpnconnectionsPostUnprocessableEntity handles this case with default header values. +/* PcloudVpnconnectionsPostUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -240,6 +246,9 @@ type PcloudVpnconnectionsPostUnprocessableEntity struct { func (o *PcloudVpnconnectionsPostUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections][%d] pcloudVpnconnectionsPostUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudVpnconnectionsPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsPostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -258,7 +267,7 @@ func NewPcloudVpnconnectionsPostInternalServerError() *PcloudVpnconnectionsPostI return &PcloudVpnconnectionsPostInternalServerError{} } -/*PcloudVpnconnectionsPostInternalServerError handles this case with default header values. +/* PcloudVpnconnectionsPostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -269,6 +278,9 @@ type PcloudVpnconnectionsPostInternalServerError struct { func (o *PcloudVpnconnectionsPostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections][%d] pcloudVpnconnectionsPostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudVpnconnectionsPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_put_parameters.go b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_put_parameters.go index e0669aba..5775cb00 100644 --- a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_put_parameters.go +++ b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_put_parameters.go @@ -13,69 +13,69 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudVpnconnectionsPutParams creates a new PcloudVpnconnectionsPutParams object -// with the default values initialized. +// NewPcloudVpnconnectionsPutParams creates a new PcloudVpnconnectionsPutParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudVpnconnectionsPutParams() *PcloudVpnconnectionsPutParams { - var () return &PcloudVpnconnectionsPutParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudVpnconnectionsPutParamsWithTimeout creates a new PcloudVpnconnectionsPutParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudVpnconnectionsPutParamsWithTimeout(timeout time.Duration) *PcloudVpnconnectionsPutParams { - var () return &PcloudVpnconnectionsPutParams{ - timeout: timeout, } } // NewPcloudVpnconnectionsPutParamsWithContext creates a new PcloudVpnconnectionsPutParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudVpnconnectionsPutParamsWithContext(ctx context.Context) *PcloudVpnconnectionsPutParams { - var () return &PcloudVpnconnectionsPutParams{ - Context: ctx, } } // NewPcloudVpnconnectionsPutParamsWithHTTPClient creates a new PcloudVpnconnectionsPutParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudVpnconnectionsPutParamsWithHTTPClient(client *http.Client) *PcloudVpnconnectionsPutParams { - var () return &PcloudVpnconnectionsPutParams{ HTTPClient: client, } } -/*PcloudVpnconnectionsPutParams contains all the parameters to send to the API endpoint -for the pcloud vpnconnections put operation typically these are written to a http.Request +/* PcloudVpnconnectionsPutParams contains all the parameters to send to the API endpoint + for the pcloud vpnconnections put operation. + + Typically these are written to a http.Request. */ type PcloudVpnconnectionsPutParams struct { - /*Body - VPN Connection object used for update + /* Body. + VPN Connection object used for update */ Body *models.VPNConnectionUpdate - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*VpnConnectionID - ID of a VPN connection + /* VpnConnectionID. + + ID of a VPN connection */ VpnConnectionID string @@ -84,6 +84,21 @@ type PcloudVpnconnectionsPutParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud vpnconnections put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsPutParams) WithDefaults() *PcloudVpnconnectionsPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud vpnconnections put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsPutParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud vpnconnections put params func (o *PcloudVpnconnectionsPutParams) WithTimeout(timeout time.Duration) *PcloudVpnconnectionsPutParams { o.SetTimeout(timeout) @@ -157,7 +172,6 @@ func (o *PcloudVpnconnectionsPutParams) WriteToRequest(r runtime.ClientRequest, return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_put_responses.go b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_put_responses.go index a6530f96..2e2026de 100644 --- a/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_put_responses.go +++ b/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_put_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudVpnconnectionsPutReader is a Reader for the PcloudVpnconnectionsPut structure. @@ -24,58 +23,50 @@ type PcloudVpnconnectionsPutReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudVpnconnectionsPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudVpnconnectionsPutOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudVpnconnectionsPutBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudVpnconnectionsPutUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 403: result := NewPcloudVpnconnectionsPutForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudVpnconnectionsPutNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudVpnconnectionsPutUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudVpnconnectionsPutInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -84,7 +75,7 @@ func NewPcloudVpnconnectionsPutOK() *PcloudVpnconnectionsPutOK { return &PcloudVpnconnectionsPutOK{} } -/*PcloudVpnconnectionsPutOK handles this case with default header values. +/* PcloudVpnconnectionsPutOK describes a response with status code 200, with default header values. OK */ @@ -95,6 +86,9 @@ type PcloudVpnconnectionsPutOK struct { func (o *PcloudVpnconnectionsPutOK) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsPutOK %+v", 200, o.Payload) } +func (o *PcloudVpnconnectionsPutOK) GetPayload() *models.VPNConnection { + return o.Payload +} func (o *PcloudVpnconnectionsPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -113,7 +107,7 @@ func NewPcloudVpnconnectionsPutBadRequest() *PcloudVpnconnectionsPutBadRequest { return &PcloudVpnconnectionsPutBadRequest{} } -/*PcloudVpnconnectionsPutBadRequest handles this case with default header values. +/* PcloudVpnconnectionsPutBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -124,6 +118,9 @@ type PcloudVpnconnectionsPutBadRequest struct { func (o *PcloudVpnconnectionsPutBadRequest) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsPutBadRequest %+v", 400, o.Payload) } +func (o *PcloudVpnconnectionsPutBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsPutBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -142,7 +139,7 @@ func NewPcloudVpnconnectionsPutUnauthorized() *PcloudVpnconnectionsPutUnauthoriz return &PcloudVpnconnectionsPutUnauthorized{} } -/*PcloudVpnconnectionsPutUnauthorized handles this case with default header values. +/* PcloudVpnconnectionsPutUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -153,6 +150,9 @@ type PcloudVpnconnectionsPutUnauthorized struct { func (o *PcloudVpnconnectionsPutUnauthorized) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsPutUnauthorized %+v", 401, o.Payload) } +func (o *PcloudVpnconnectionsPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsPutUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -171,7 +171,7 @@ func NewPcloudVpnconnectionsPutForbidden() *PcloudVpnconnectionsPutForbidden { return &PcloudVpnconnectionsPutForbidden{} } -/*PcloudVpnconnectionsPutForbidden handles this case with default header values. +/* PcloudVpnconnectionsPutForbidden describes a response with status code 403, with default header values. Forbidden */ @@ -182,6 +182,9 @@ type PcloudVpnconnectionsPutForbidden struct { func (o *PcloudVpnconnectionsPutForbidden) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsPutForbidden %+v", 403, o.Payload) } +func (o *PcloudVpnconnectionsPutForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsPutForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -200,7 +203,7 @@ func NewPcloudVpnconnectionsPutNotFound() *PcloudVpnconnectionsPutNotFound { return &PcloudVpnconnectionsPutNotFound{} } -/*PcloudVpnconnectionsPutNotFound handles this case with default header values. +/* PcloudVpnconnectionsPutNotFound describes a response with status code 404, with default header values. Not Found */ @@ -211,6 +214,9 @@ type PcloudVpnconnectionsPutNotFound struct { func (o *PcloudVpnconnectionsPutNotFound) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsPutNotFound %+v", 404, o.Payload) } +func (o *PcloudVpnconnectionsPutNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsPutNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -229,7 +235,7 @@ func NewPcloudVpnconnectionsPutUnprocessableEntity() *PcloudVpnconnectionsPutUnp return &PcloudVpnconnectionsPutUnprocessableEntity{} } -/*PcloudVpnconnectionsPutUnprocessableEntity handles this case with default header values. +/* PcloudVpnconnectionsPutUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -240,6 +246,9 @@ type PcloudVpnconnectionsPutUnprocessableEntity struct { func (o *PcloudVpnconnectionsPutUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsPutUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudVpnconnectionsPutUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsPutUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -258,7 +267,7 @@ func NewPcloudVpnconnectionsPutInternalServerError() *PcloudVpnconnectionsPutInt return &PcloudVpnconnectionsPutInternalServerError{} } -/*PcloudVpnconnectionsPutInternalServerError handles this case with default header values. +/* PcloudVpnconnectionsPutInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -269,6 +278,9 @@ type PcloudVpnconnectionsPutInternalServerError struct { func (o *PcloudVpnconnectionsPutInternalServerError) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsPutInternalServerError %+v", 500, o.Payload) } +func (o *PcloudVpnconnectionsPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVpnconnectionsPutInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_v_p_n_policies/p_cloud_v_p_n_policies_client.go b/power/client/p_cloud_v_p_n_policies/p_cloud_v_p_n_policies_client.go deleted file mode 100644 index 6a0f1890..00000000 --- a/power/client/p_cloud_v_p_n_policies/p_cloud_v_p_n_policies_client.go +++ /dev/null @@ -1,340 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package p_cloud_v_p_n_policies - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "github.com/go-openapi/runtime" - - strfmt "github.com/go-openapi/strfmt" -) - -// New creates a new p cloud v p n policies API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { - return &Client{transport: transport, formats: formats} -} - -/* -Client for p cloud v p n policies API -*/ -type Client struct { - transport runtime.ClientTransport - formats strfmt.Registry -} - -/* -PcloudIkepoliciesDelete deletes i k e policy - -Delete an IKE Policy (by its unique identifier) -*/ -func (a *Client) PcloudIkepoliciesDelete(params *PcloudIkepoliciesDeleteParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudIkepoliciesDeleteOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudIkepoliciesDeleteParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.ikepolicies.delete", - Method: "DELETE", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudIkepoliciesDeleteReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudIkepoliciesDeleteOK), nil - -} - -/* -PcloudIkepoliciesGet gets the specified i k e policy - -Get an IKE Policy (by its unique identifier) -*/ -func (a *Client) PcloudIkepoliciesGet(params *PcloudIkepoliciesGetParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudIkepoliciesGetOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudIkepoliciesGetParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.ikepolicies.get", - Method: "GET", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudIkepoliciesGetReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudIkepoliciesGetOK), nil - -} - -/* -PcloudIkepoliciesGetall gets all i k e policies - -List all IKE Policies with all attributes -*/ -func (a *Client) PcloudIkepoliciesGetall(params *PcloudIkepoliciesGetallParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudIkepoliciesGetallOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudIkepoliciesGetallParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.ikepolicies.getall", - Method: "GET", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudIkepoliciesGetallReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudIkepoliciesGetallOK), nil - -} - -/* -PcloudIkepoliciesPost adds i k e policy - -Add a new IKE Policy -*/ -func (a *Client) PcloudIkepoliciesPost(params *PcloudIkepoliciesPostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudIkepoliciesPostOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudIkepoliciesPostParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.ikepolicies.post", - Method: "POST", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudIkepoliciesPostReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudIkepoliciesPostOK), nil - -} - -/* -PcloudIkepoliciesPut updates i k e policy - -update an IKE Policy (by its unique identifier) -*/ -func (a *Client) PcloudIkepoliciesPut(params *PcloudIkepoliciesPutParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudIkepoliciesPutOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudIkepoliciesPutParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.ikepolicies.put", - Method: "PUT", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudIkepoliciesPutReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudIkepoliciesPutOK), nil - -} - -/* -PcloudIpsecpoliciesDelete deletes IP sec policy - -Delete an IPSec Policy (by its unique identifier) -*/ -func (a *Client) PcloudIpsecpoliciesDelete(params *PcloudIpsecpoliciesDeleteParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudIpsecpoliciesDeleteOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudIpsecpoliciesDeleteParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.ipsecpolicies.delete", - Method: "DELETE", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudIpsecpoliciesDeleteReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudIpsecpoliciesDeleteOK), nil - -} - -/* -PcloudIpsecpoliciesGet gets the specified IP sec policy - -Get an IPSec Policy (by its unique identifier) -*/ -func (a *Client) PcloudIpsecpoliciesGet(params *PcloudIpsecpoliciesGetParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudIpsecpoliciesGetOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudIpsecpoliciesGetParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.ipsecpolicies.get", - Method: "GET", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudIpsecpoliciesGetReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudIpsecpoliciesGetOK), nil - -} - -/* -PcloudIpsecpoliciesGetall gets all IP sec policies - -Get all IPSec Policies with all their attributes -*/ -func (a *Client) PcloudIpsecpoliciesGetall(params *PcloudIpsecpoliciesGetallParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudIpsecpoliciesGetallOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudIpsecpoliciesGetallParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.ipsecpolicies.getall", - Method: "GET", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudIpsecpoliciesGetallReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudIpsecpoliciesGetallOK), nil - -} - -/* -PcloudIpsecpoliciesPost adds IP sec policy - -Add a new IPSec Policy -*/ -func (a *Client) PcloudIpsecpoliciesPost(params *PcloudIpsecpoliciesPostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudIpsecpoliciesPostOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudIpsecpoliciesPostParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.ipsecpolicies.post", - Method: "POST", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudIpsecpoliciesPostReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudIpsecpoliciesPostOK), nil - -} - -/* -PcloudIpsecpoliciesPut updates IP sec policy - -update an IPSec Policy -*/ -func (a *Client) PcloudIpsecpoliciesPut(params *PcloudIpsecpoliciesPutParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudIpsecpoliciesPutOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPcloudIpsecpoliciesPutParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "pcloud.ipsecpolicies.put", - Method: "PUT", - PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PcloudIpsecpoliciesPutReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*PcloudIpsecpoliciesPutOK), nil - -} - -// SetTransport changes the transport on the client -func (a *Client) SetTransport(transport runtime.ClientTransport) { - a.transport = transport -} diff --git a/power/client/p_cloud_v_p_n_policies/p_cloudvpn_policies_client.go b/power/client/p_cloud_v_p_n_policies/p_cloudvpn_policies_client.go new file mode 100644 index 00000000..677be4f2 --- /dev/null +++ b/power/client/p_cloud_v_p_n_policies/p_cloudvpn_policies_client.go @@ -0,0 +1,469 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_policies + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// New creates a new p cloud v p n policies API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for p cloud v p n policies API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudIkepoliciesDelete(params *PcloudIkepoliciesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIkepoliciesDeleteOK, error) + + PcloudIkepoliciesGet(params *PcloudIkepoliciesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIkepoliciesGetOK, error) + + PcloudIkepoliciesGetall(params *PcloudIkepoliciesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIkepoliciesGetallOK, error) + + PcloudIkepoliciesPost(params *PcloudIkepoliciesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIkepoliciesPostOK, error) + + PcloudIkepoliciesPut(params *PcloudIkepoliciesPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIkepoliciesPutOK, error) + + PcloudIpsecpoliciesDelete(params *PcloudIpsecpoliciesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIpsecpoliciesDeleteOK, error) + + PcloudIpsecpoliciesGet(params *PcloudIpsecpoliciesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIpsecpoliciesGetOK, error) + + PcloudIpsecpoliciesGetall(params *PcloudIpsecpoliciesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIpsecpoliciesGetallOK, error) + + PcloudIpsecpoliciesPost(params *PcloudIpsecpoliciesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIpsecpoliciesPostOK, error) + + PcloudIpsecpoliciesPut(params *PcloudIpsecpoliciesPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIpsecpoliciesPutOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + PcloudIkepoliciesDelete deletes i k e policy + + Delete an IKE Policy (by its unique identifier) +*/ +func (a *Client) PcloudIkepoliciesDelete(params *PcloudIkepoliciesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIkepoliciesDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudIkepoliciesDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.ikepolicies.delete", + Method: "DELETE", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudIkepoliciesDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudIkepoliciesDeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.ikepolicies.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudIkepoliciesGet gets the specified i k e policy + + Get an IKE Policy (by its unique identifier) +*/ +func (a *Client) PcloudIkepoliciesGet(params *PcloudIkepoliciesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIkepoliciesGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudIkepoliciesGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.ikepolicies.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudIkepoliciesGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudIkepoliciesGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.ikepolicies.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudIkepoliciesGetall gets all i k e policies + + List all IKE Policies with all attributes +*/ +func (a *Client) PcloudIkepoliciesGetall(params *PcloudIkepoliciesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIkepoliciesGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudIkepoliciesGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.ikepolicies.getall", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudIkepoliciesGetallReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudIkepoliciesGetallOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.ikepolicies.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudIkepoliciesPost adds i k e policy + + Add a new IKE Policy +*/ +func (a *Client) PcloudIkepoliciesPost(params *PcloudIkepoliciesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIkepoliciesPostOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudIkepoliciesPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.ikepolicies.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudIkepoliciesPostReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudIkepoliciesPostOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.ikepolicies.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudIkepoliciesPut updates i k e policy + + update an IKE Policy (by its unique identifier) +*/ +func (a *Client) PcloudIkepoliciesPut(params *PcloudIkepoliciesPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIkepoliciesPutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudIkepoliciesPutParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.ikepolicies.put", + Method: "PUT", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudIkepoliciesPutReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudIkepoliciesPutOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.ikepolicies.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudIpsecpoliciesDelete deletes IP sec policy + + Delete an IPSec Policy (by its unique identifier) +*/ +func (a *Client) PcloudIpsecpoliciesDelete(params *PcloudIpsecpoliciesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIpsecpoliciesDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudIpsecpoliciesDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.ipsecpolicies.delete", + Method: "DELETE", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudIpsecpoliciesDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudIpsecpoliciesDeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.ipsecpolicies.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudIpsecpoliciesGet gets the specified IP sec policy + + Get an IPSec Policy (by its unique identifier) +*/ +func (a *Client) PcloudIpsecpoliciesGet(params *PcloudIpsecpoliciesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIpsecpoliciesGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudIpsecpoliciesGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.ipsecpolicies.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudIpsecpoliciesGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudIpsecpoliciesGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.ipsecpolicies.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudIpsecpoliciesGetall gets all IP sec policies + + Get all IPSec Policies with all their attributes +*/ +func (a *Client) PcloudIpsecpoliciesGetall(params *PcloudIpsecpoliciesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIpsecpoliciesGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudIpsecpoliciesGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.ipsecpolicies.getall", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudIpsecpoliciesGetallReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudIpsecpoliciesGetallOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.ipsecpolicies.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudIpsecpoliciesPost adds IP sec policy + + Add a new IPSec Policy +*/ +func (a *Client) PcloudIpsecpoliciesPost(params *PcloudIpsecpoliciesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIpsecpoliciesPostOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudIpsecpoliciesPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.ipsecpolicies.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudIpsecpoliciesPostReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudIpsecpoliciesPostOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.ipsecpolicies.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudIpsecpoliciesPut updates IP sec policy + + update an IPSec Policy +*/ +func (a *Client) PcloudIpsecpoliciesPut(params *PcloudIpsecpoliciesPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIpsecpoliciesPutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudIpsecpoliciesPutParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.ipsecpolicies.put", + Method: "PUT", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudIpsecpoliciesPutReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PcloudIpsecpoliciesPutOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.ipsecpolicies.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_delete_parameters.go b/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_delete_parameters.go index 6c27c39b..7463101d 100644 --- a/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_delete_parameters.go +++ b/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_delete_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudIkepoliciesDeleteParams creates a new PcloudIkepoliciesDeleteParams object -// with the default values initialized. +// NewPcloudIkepoliciesDeleteParams creates a new PcloudIkepoliciesDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudIkepoliciesDeleteParams() *PcloudIkepoliciesDeleteParams { - var () return &PcloudIkepoliciesDeleteParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudIkepoliciesDeleteParamsWithTimeout creates a new PcloudIkepoliciesDeleteParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudIkepoliciesDeleteParamsWithTimeout(timeout time.Duration) *PcloudIkepoliciesDeleteParams { - var () return &PcloudIkepoliciesDeleteParams{ - timeout: timeout, } } // NewPcloudIkepoliciesDeleteParamsWithContext creates a new PcloudIkepoliciesDeleteParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudIkepoliciesDeleteParamsWithContext(ctx context.Context) *PcloudIkepoliciesDeleteParams { - var () return &PcloudIkepoliciesDeleteParams{ - Context: ctx, } } // NewPcloudIkepoliciesDeleteParamsWithHTTPClient creates a new PcloudIkepoliciesDeleteParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudIkepoliciesDeleteParamsWithHTTPClient(client *http.Client) *PcloudIkepoliciesDeleteParams { - var () return &PcloudIkepoliciesDeleteParams{ HTTPClient: client, } } -/*PcloudIkepoliciesDeleteParams contains all the parameters to send to the API endpoint -for the pcloud ikepolicies delete operation typically these are written to a http.Request +/* PcloudIkepoliciesDeleteParams contains all the parameters to send to the API endpoint + for the pcloud ikepolicies delete operation. + + Typically these are written to a http.Request. */ type PcloudIkepoliciesDeleteParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*IkePolicyID - ID of a IKE Policy + /* IkePolicyID. + + ID of a IKE Policy */ IkePolicyID string @@ -77,6 +76,21 @@ type PcloudIkepoliciesDeleteParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud ikepolicies delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIkepoliciesDeleteParams) WithDefaults() *PcloudIkepoliciesDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud ikepolicies delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIkepoliciesDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud ikepolicies delete params func (o *PcloudIkepoliciesDeleteParams) WithTimeout(timeout time.Duration) *PcloudIkepoliciesDeleteParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_delete_responses.go b/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_delete_responses.go index 6aeb58b0..72c1b0f4 100644 --- a/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_delete_responses.go +++ b/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_delete_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudIkepoliciesDeleteReader is a Reader for the PcloudIkepoliciesDelete structure. @@ -24,44 +23,38 @@ type PcloudIkepoliciesDeleteReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudIkepoliciesDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudIkepoliciesDeleteOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudIkepoliciesDeleteBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudIkepoliciesDeleteUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 403: result := NewPcloudIkepoliciesDeleteForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudIkepoliciesDeleteInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudIkepoliciesDeleteOK() *PcloudIkepoliciesDeleteOK { return &PcloudIkepoliciesDeleteOK{} } -/*PcloudIkepoliciesDeleteOK handles this case with default header values. +/* PcloudIkepoliciesDeleteOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudIkepoliciesDeleteOK struct { func (o *PcloudIkepoliciesDeleteOK) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesDeleteOK %+v", 200, o.Payload) } +func (o *PcloudIkepoliciesDeleteOK) GetPayload() models.Object { + return o.Payload +} func (o *PcloudIkepoliciesDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -97,7 +93,7 @@ func NewPcloudIkepoliciesDeleteBadRequest() *PcloudIkepoliciesDeleteBadRequest { return &PcloudIkepoliciesDeleteBadRequest{} } -/*PcloudIkepoliciesDeleteBadRequest handles this case with default header values. +/* PcloudIkepoliciesDeleteBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -108,6 +104,9 @@ type PcloudIkepoliciesDeleteBadRequest struct { func (o *PcloudIkepoliciesDeleteBadRequest) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesDeleteBadRequest %+v", 400, o.Payload) } +func (o *PcloudIkepoliciesDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIkepoliciesDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -126,7 +125,7 @@ func NewPcloudIkepoliciesDeleteUnauthorized() *PcloudIkepoliciesDeleteUnauthoriz return &PcloudIkepoliciesDeleteUnauthorized{} } -/*PcloudIkepoliciesDeleteUnauthorized handles this case with default header values. +/* PcloudIkepoliciesDeleteUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -137,6 +136,9 @@ type PcloudIkepoliciesDeleteUnauthorized struct { func (o *PcloudIkepoliciesDeleteUnauthorized) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesDeleteUnauthorized %+v", 401, o.Payload) } +func (o *PcloudIkepoliciesDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIkepoliciesDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -155,7 +157,7 @@ func NewPcloudIkepoliciesDeleteForbidden() *PcloudIkepoliciesDeleteForbidden { return &PcloudIkepoliciesDeleteForbidden{} } -/*PcloudIkepoliciesDeleteForbidden handles this case with default header values. +/* PcloudIkepoliciesDeleteForbidden describes a response with status code 403, with default header values. Forbidden */ @@ -166,6 +168,9 @@ type PcloudIkepoliciesDeleteForbidden struct { func (o *PcloudIkepoliciesDeleteForbidden) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesDeleteForbidden %+v", 403, o.Payload) } +func (o *PcloudIkepoliciesDeleteForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIkepoliciesDeleteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -184,7 +189,7 @@ func NewPcloudIkepoliciesDeleteInternalServerError() *PcloudIkepoliciesDeleteInt return &PcloudIkepoliciesDeleteInternalServerError{} } -/*PcloudIkepoliciesDeleteInternalServerError handles this case with default header values. +/* PcloudIkepoliciesDeleteInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -195,6 +200,9 @@ type PcloudIkepoliciesDeleteInternalServerError struct { func (o *PcloudIkepoliciesDeleteInternalServerError) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesDeleteInternalServerError %+v", 500, o.Payload) } +func (o *PcloudIkepoliciesDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIkepoliciesDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_get_parameters.go b/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_get_parameters.go index 3b61f399..9a0318cf 100644 --- a/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_get_parameters.go +++ b/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_get_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudIkepoliciesGetParams creates a new PcloudIkepoliciesGetParams object -// with the default values initialized. +// NewPcloudIkepoliciesGetParams creates a new PcloudIkepoliciesGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudIkepoliciesGetParams() *PcloudIkepoliciesGetParams { - var () return &PcloudIkepoliciesGetParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudIkepoliciesGetParamsWithTimeout creates a new PcloudIkepoliciesGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudIkepoliciesGetParamsWithTimeout(timeout time.Duration) *PcloudIkepoliciesGetParams { - var () return &PcloudIkepoliciesGetParams{ - timeout: timeout, } } // NewPcloudIkepoliciesGetParamsWithContext creates a new PcloudIkepoliciesGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudIkepoliciesGetParamsWithContext(ctx context.Context) *PcloudIkepoliciesGetParams { - var () return &PcloudIkepoliciesGetParams{ - Context: ctx, } } // NewPcloudIkepoliciesGetParamsWithHTTPClient creates a new PcloudIkepoliciesGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudIkepoliciesGetParamsWithHTTPClient(client *http.Client) *PcloudIkepoliciesGetParams { - var () return &PcloudIkepoliciesGetParams{ HTTPClient: client, } } -/*PcloudIkepoliciesGetParams contains all the parameters to send to the API endpoint -for the pcloud ikepolicies get operation typically these are written to a http.Request +/* PcloudIkepoliciesGetParams contains all the parameters to send to the API endpoint + for the pcloud ikepolicies get operation. + + Typically these are written to a http.Request. */ type PcloudIkepoliciesGetParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*IkePolicyID - ID of a IKE Policy + /* IkePolicyID. + + ID of a IKE Policy */ IkePolicyID string @@ -77,6 +76,21 @@ type PcloudIkepoliciesGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud ikepolicies get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIkepoliciesGetParams) WithDefaults() *PcloudIkepoliciesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud ikepolicies get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIkepoliciesGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud ikepolicies get params func (o *PcloudIkepoliciesGetParams) WithTimeout(timeout time.Duration) *PcloudIkepoliciesGetParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_get_responses.go b/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_get_responses.go index 6bef5769..2f29ccef 100644 --- a/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_get_responses.go +++ b/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudIkepoliciesGetReader is a Reader for the PcloudIkepoliciesGet structure. @@ -24,51 +23,44 @@ type PcloudIkepoliciesGetReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudIkepoliciesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudIkepoliciesGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudIkepoliciesGetBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudIkepoliciesGetUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 403: result := NewPcloudIkepoliciesGetForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudIkepoliciesGetUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudIkepoliciesGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -77,7 +69,7 @@ func NewPcloudIkepoliciesGetOK() *PcloudIkepoliciesGetOK { return &PcloudIkepoliciesGetOK{} } -/*PcloudIkepoliciesGetOK handles this case with default header values. +/* PcloudIkepoliciesGetOK describes a response with status code 200, with default header values. OK */ @@ -88,6 +80,9 @@ type PcloudIkepoliciesGetOK struct { func (o *PcloudIkepoliciesGetOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesGetOK %+v", 200, o.Payload) } +func (o *PcloudIkepoliciesGetOK) GetPayload() *models.IKEPolicy { + return o.Payload +} func (o *PcloudIkepoliciesGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -106,7 +101,7 @@ func NewPcloudIkepoliciesGetBadRequest() *PcloudIkepoliciesGetBadRequest { return &PcloudIkepoliciesGetBadRequest{} } -/*PcloudIkepoliciesGetBadRequest handles this case with default header values. +/* PcloudIkepoliciesGetBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -117,6 +112,9 @@ type PcloudIkepoliciesGetBadRequest struct { func (o *PcloudIkepoliciesGetBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesGetBadRequest %+v", 400, o.Payload) } +func (o *PcloudIkepoliciesGetBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIkepoliciesGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -135,7 +133,7 @@ func NewPcloudIkepoliciesGetUnauthorized() *PcloudIkepoliciesGetUnauthorized { return &PcloudIkepoliciesGetUnauthorized{} } -/*PcloudIkepoliciesGetUnauthorized handles this case with default header values. +/* PcloudIkepoliciesGetUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -146,6 +144,9 @@ type PcloudIkepoliciesGetUnauthorized struct { func (o *PcloudIkepoliciesGetUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesGetUnauthorized %+v", 401, o.Payload) } +func (o *PcloudIkepoliciesGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIkepoliciesGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -164,7 +165,7 @@ func NewPcloudIkepoliciesGetForbidden() *PcloudIkepoliciesGetForbidden { return &PcloudIkepoliciesGetForbidden{} } -/*PcloudIkepoliciesGetForbidden handles this case with default header values. +/* PcloudIkepoliciesGetForbidden describes a response with status code 403, with default header values. Forbidden */ @@ -175,6 +176,9 @@ type PcloudIkepoliciesGetForbidden struct { func (o *PcloudIkepoliciesGetForbidden) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesGetForbidden %+v", 403, o.Payload) } +func (o *PcloudIkepoliciesGetForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIkepoliciesGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -193,7 +197,7 @@ func NewPcloudIkepoliciesGetUnprocessableEntity() *PcloudIkepoliciesGetUnprocess return &PcloudIkepoliciesGetUnprocessableEntity{} } -/*PcloudIkepoliciesGetUnprocessableEntity handles this case with default header values. +/* PcloudIkepoliciesGetUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -204,6 +208,9 @@ type PcloudIkepoliciesGetUnprocessableEntity struct { func (o *PcloudIkepoliciesGetUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesGetUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudIkepoliciesGetUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIkepoliciesGetUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -222,7 +229,7 @@ func NewPcloudIkepoliciesGetInternalServerError() *PcloudIkepoliciesGetInternalS return &PcloudIkepoliciesGetInternalServerError{} } -/*PcloudIkepoliciesGetInternalServerError handles this case with default header values. +/* PcloudIkepoliciesGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -233,6 +240,9 @@ type PcloudIkepoliciesGetInternalServerError struct { func (o *PcloudIkepoliciesGetInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesGetInternalServerError %+v", 500, o.Payload) } +func (o *PcloudIkepoliciesGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIkepoliciesGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_getall_parameters.go b/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_getall_parameters.go index 16f05f90..c83d29a4 100644 --- a/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_getall_parameters.go +++ b/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_getall_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudIkepoliciesGetallParams creates a new PcloudIkepoliciesGetallParams object -// with the default values initialized. +// NewPcloudIkepoliciesGetallParams creates a new PcloudIkepoliciesGetallParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudIkepoliciesGetallParams() *PcloudIkepoliciesGetallParams { - var () return &PcloudIkepoliciesGetallParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudIkepoliciesGetallParamsWithTimeout creates a new PcloudIkepoliciesGetallParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudIkepoliciesGetallParamsWithTimeout(timeout time.Duration) *PcloudIkepoliciesGetallParams { - var () return &PcloudIkepoliciesGetallParams{ - timeout: timeout, } } // NewPcloudIkepoliciesGetallParamsWithContext creates a new PcloudIkepoliciesGetallParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudIkepoliciesGetallParamsWithContext(ctx context.Context) *PcloudIkepoliciesGetallParams { - var () return &PcloudIkepoliciesGetallParams{ - Context: ctx, } } // NewPcloudIkepoliciesGetallParamsWithHTTPClient creates a new PcloudIkepoliciesGetallParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudIkepoliciesGetallParamsWithHTTPClient(client *http.Client) *PcloudIkepoliciesGetallParams { - var () return &PcloudIkepoliciesGetallParams{ HTTPClient: client, } } -/*PcloudIkepoliciesGetallParams contains all the parameters to send to the API endpoint -for the pcloud ikepolicies getall operation typically these are written to a http.Request +/* PcloudIkepoliciesGetallParams contains all the parameters to send to the API endpoint + for the pcloud ikepolicies getall operation. + + Typically these are written to a http.Request. */ type PcloudIkepoliciesGetallParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -72,6 +70,21 @@ type PcloudIkepoliciesGetallParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud ikepolicies getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIkepoliciesGetallParams) WithDefaults() *PcloudIkepoliciesGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud ikepolicies getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIkepoliciesGetallParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud ikepolicies getall params func (o *PcloudIkepoliciesGetallParams) WithTimeout(timeout time.Duration) *PcloudIkepoliciesGetallParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_getall_responses.go b/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_getall_responses.go index e31868f2..8286d8f0 100644 --- a/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_getall_responses.go +++ b/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_getall_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudIkepoliciesGetallReader is a Reader for the PcloudIkepoliciesGetall structure. @@ -24,51 +23,44 @@ type PcloudIkepoliciesGetallReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudIkepoliciesGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudIkepoliciesGetallOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudIkepoliciesGetallBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudIkepoliciesGetallUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 403: result := NewPcloudIkepoliciesGetallForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudIkepoliciesGetallNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudIkepoliciesGetallInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -77,7 +69,7 @@ func NewPcloudIkepoliciesGetallOK() *PcloudIkepoliciesGetallOK { return &PcloudIkepoliciesGetallOK{} } -/*PcloudIkepoliciesGetallOK handles this case with default header values. +/* PcloudIkepoliciesGetallOK describes a response with status code 200, with default header values. OK */ @@ -88,6 +80,9 @@ type PcloudIkepoliciesGetallOK struct { func (o *PcloudIkepoliciesGetallOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies][%d] pcloudIkepoliciesGetallOK %+v", 200, o.Payload) } +func (o *PcloudIkepoliciesGetallOK) GetPayload() *models.IKEPolicies { + return o.Payload +} func (o *PcloudIkepoliciesGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -106,7 +101,7 @@ func NewPcloudIkepoliciesGetallBadRequest() *PcloudIkepoliciesGetallBadRequest { return &PcloudIkepoliciesGetallBadRequest{} } -/*PcloudIkepoliciesGetallBadRequest handles this case with default header values. +/* PcloudIkepoliciesGetallBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -117,6 +112,9 @@ type PcloudIkepoliciesGetallBadRequest struct { func (o *PcloudIkepoliciesGetallBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies][%d] pcloudIkepoliciesGetallBadRequest %+v", 400, o.Payload) } +func (o *PcloudIkepoliciesGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIkepoliciesGetallBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -135,7 +133,7 @@ func NewPcloudIkepoliciesGetallUnauthorized() *PcloudIkepoliciesGetallUnauthoriz return &PcloudIkepoliciesGetallUnauthorized{} } -/*PcloudIkepoliciesGetallUnauthorized handles this case with default header values. +/* PcloudIkepoliciesGetallUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -146,6 +144,9 @@ type PcloudIkepoliciesGetallUnauthorized struct { func (o *PcloudIkepoliciesGetallUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies][%d] pcloudIkepoliciesGetallUnauthorized %+v", 401, o.Payload) } +func (o *PcloudIkepoliciesGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIkepoliciesGetallUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -164,7 +165,7 @@ func NewPcloudIkepoliciesGetallForbidden() *PcloudIkepoliciesGetallForbidden { return &PcloudIkepoliciesGetallForbidden{} } -/*PcloudIkepoliciesGetallForbidden handles this case with default header values. +/* PcloudIkepoliciesGetallForbidden describes a response with status code 403, with default header values. Forbidden */ @@ -175,6 +176,9 @@ type PcloudIkepoliciesGetallForbidden struct { func (o *PcloudIkepoliciesGetallForbidden) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies][%d] pcloudIkepoliciesGetallForbidden %+v", 403, o.Payload) } +func (o *PcloudIkepoliciesGetallForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIkepoliciesGetallForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -193,7 +197,7 @@ func NewPcloudIkepoliciesGetallNotFound() *PcloudIkepoliciesGetallNotFound { return &PcloudIkepoliciesGetallNotFound{} } -/*PcloudIkepoliciesGetallNotFound handles this case with default header values. +/* PcloudIkepoliciesGetallNotFound describes a response with status code 404, with default header values. Not Found */ @@ -204,6 +208,9 @@ type PcloudIkepoliciesGetallNotFound struct { func (o *PcloudIkepoliciesGetallNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies][%d] pcloudIkepoliciesGetallNotFound %+v", 404, o.Payload) } +func (o *PcloudIkepoliciesGetallNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIkepoliciesGetallNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -222,7 +229,7 @@ func NewPcloudIkepoliciesGetallInternalServerError() *PcloudIkepoliciesGetallInt return &PcloudIkepoliciesGetallInternalServerError{} } -/*PcloudIkepoliciesGetallInternalServerError handles this case with default header values. +/* PcloudIkepoliciesGetallInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -233,6 +240,9 @@ type PcloudIkepoliciesGetallInternalServerError struct { func (o *PcloudIkepoliciesGetallInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies][%d] pcloudIkepoliciesGetallInternalServerError %+v", 500, o.Payload) } +func (o *PcloudIkepoliciesGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIkepoliciesGetallInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_post_parameters.go b/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_post_parameters.go index 2b4db36f..57d82f09 100644 --- a/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_post_parameters.go +++ b/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_post_parameters.go @@ -13,64 +13,63 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudIkepoliciesPostParams creates a new PcloudIkepoliciesPostParams object -// with the default values initialized. +// NewPcloudIkepoliciesPostParams creates a new PcloudIkepoliciesPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudIkepoliciesPostParams() *PcloudIkepoliciesPostParams { - var () return &PcloudIkepoliciesPostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudIkepoliciesPostParamsWithTimeout creates a new PcloudIkepoliciesPostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudIkepoliciesPostParamsWithTimeout(timeout time.Duration) *PcloudIkepoliciesPostParams { - var () return &PcloudIkepoliciesPostParams{ - timeout: timeout, } } // NewPcloudIkepoliciesPostParamsWithContext creates a new PcloudIkepoliciesPostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudIkepoliciesPostParamsWithContext(ctx context.Context) *PcloudIkepoliciesPostParams { - var () return &PcloudIkepoliciesPostParams{ - Context: ctx, } } // NewPcloudIkepoliciesPostParamsWithHTTPClient creates a new PcloudIkepoliciesPostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudIkepoliciesPostParamsWithHTTPClient(client *http.Client) *PcloudIkepoliciesPostParams { - var () return &PcloudIkepoliciesPostParams{ HTTPClient: client, } } -/*PcloudIkepoliciesPostParams contains all the parameters to send to the API endpoint -for the pcloud ikepolicies post operation typically these are written to a http.Request +/* PcloudIkepoliciesPostParams contains all the parameters to send to the API endpoint + for the pcloud ikepolicies post operation. + + Typically these are written to a http.Request. */ type PcloudIkepoliciesPostParams struct { - /*Body - Parameters for the creation of a new IKE Policy + /* Body. + Parameters for the creation of a new IKE Policy */ Body *models.IKEPolicyCreate - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -79,6 +78,21 @@ type PcloudIkepoliciesPostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud ikepolicies post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIkepoliciesPostParams) WithDefaults() *PcloudIkepoliciesPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud ikepolicies post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIkepoliciesPostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud ikepolicies post params func (o *PcloudIkepoliciesPostParams) WithTimeout(timeout time.Duration) *PcloudIkepoliciesPostParams { o.SetTimeout(timeout) @@ -141,7 +155,6 @@ func (o *PcloudIkepoliciesPostParams) WriteToRequest(r runtime.ClientRequest, re return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_post_responses.go b/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_post_responses.go index 1e6e5d34..3b3d8196 100644 --- a/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_post_responses.go +++ b/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudIkepoliciesPostReader is a Reader for the PcloudIkepoliciesPost structure. @@ -24,58 +23,50 @@ type PcloudIkepoliciesPostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudIkepoliciesPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudIkepoliciesPostOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudIkepoliciesPostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudIkepoliciesPostUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 403: result := NewPcloudIkepoliciesPostForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 409: result := NewPcloudIkepoliciesPostConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudIkepoliciesPostUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudIkepoliciesPostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -84,7 +75,7 @@ func NewPcloudIkepoliciesPostOK() *PcloudIkepoliciesPostOK { return &PcloudIkepoliciesPostOK{} } -/*PcloudIkepoliciesPostOK handles this case with default header values. +/* PcloudIkepoliciesPostOK describes a response with status code 200, with default header values. OK */ @@ -95,6 +86,9 @@ type PcloudIkepoliciesPostOK struct { func (o *PcloudIkepoliciesPostOK) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies][%d] pcloudIkepoliciesPostOK %+v", 200, o.Payload) } +func (o *PcloudIkepoliciesPostOK) GetPayload() *models.IKEPolicy { + return o.Payload +} func (o *PcloudIkepoliciesPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -113,7 +107,7 @@ func NewPcloudIkepoliciesPostBadRequest() *PcloudIkepoliciesPostBadRequest { return &PcloudIkepoliciesPostBadRequest{} } -/*PcloudIkepoliciesPostBadRequest handles this case with default header values. +/* PcloudIkepoliciesPostBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -124,6 +118,9 @@ type PcloudIkepoliciesPostBadRequest struct { func (o *PcloudIkepoliciesPostBadRequest) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies][%d] pcloudIkepoliciesPostBadRequest %+v", 400, o.Payload) } +func (o *PcloudIkepoliciesPostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIkepoliciesPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -142,7 +139,7 @@ func NewPcloudIkepoliciesPostUnauthorized() *PcloudIkepoliciesPostUnauthorized { return &PcloudIkepoliciesPostUnauthorized{} } -/*PcloudIkepoliciesPostUnauthorized handles this case with default header values. +/* PcloudIkepoliciesPostUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -153,6 +150,9 @@ type PcloudIkepoliciesPostUnauthorized struct { func (o *PcloudIkepoliciesPostUnauthorized) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies][%d] pcloudIkepoliciesPostUnauthorized %+v", 401, o.Payload) } +func (o *PcloudIkepoliciesPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIkepoliciesPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -171,7 +171,7 @@ func NewPcloudIkepoliciesPostForbidden() *PcloudIkepoliciesPostForbidden { return &PcloudIkepoliciesPostForbidden{} } -/*PcloudIkepoliciesPostForbidden handles this case with default header values. +/* PcloudIkepoliciesPostForbidden describes a response with status code 403, with default header values. Forbidden */ @@ -182,6 +182,9 @@ type PcloudIkepoliciesPostForbidden struct { func (o *PcloudIkepoliciesPostForbidden) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies][%d] pcloudIkepoliciesPostForbidden %+v", 403, o.Payload) } +func (o *PcloudIkepoliciesPostForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIkepoliciesPostForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -200,7 +203,7 @@ func NewPcloudIkepoliciesPostConflict() *PcloudIkepoliciesPostConflict { return &PcloudIkepoliciesPostConflict{} } -/*PcloudIkepoliciesPostConflict handles this case with default header values. +/* PcloudIkepoliciesPostConflict describes a response with status code 409, with default header values. Conflict */ @@ -211,6 +214,9 @@ type PcloudIkepoliciesPostConflict struct { func (o *PcloudIkepoliciesPostConflict) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies][%d] pcloudIkepoliciesPostConflict %+v", 409, o.Payload) } +func (o *PcloudIkepoliciesPostConflict) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIkepoliciesPostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -229,7 +235,7 @@ func NewPcloudIkepoliciesPostUnprocessableEntity() *PcloudIkepoliciesPostUnproce return &PcloudIkepoliciesPostUnprocessableEntity{} } -/*PcloudIkepoliciesPostUnprocessableEntity handles this case with default header values. +/* PcloudIkepoliciesPostUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -240,6 +246,9 @@ type PcloudIkepoliciesPostUnprocessableEntity struct { func (o *PcloudIkepoliciesPostUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies][%d] pcloudIkepoliciesPostUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudIkepoliciesPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIkepoliciesPostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -258,7 +267,7 @@ func NewPcloudIkepoliciesPostInternalServerError() *PcloudIkepoliciesPostInterna return &PcloudIkepoliciesPostInternalServerError{} } -/*PcloudIkepoliciesPostInternalServerError handles this case with default header values. +/* PcloudIkepoliciesPostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -269,6 +278,9 @@ type PcloudIkepoliciesPostInternalServerError struct { func (o *PcloudIkepoliciesPostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies][%d] pcloudIkepoliciesPostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudIkepoliciesPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIkepoliciesPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_put_parameters.go b/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_put_parameters.go index 4ddfb840..c845b8ae 100644 --- a/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_put_parameters.go +++ b/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_put_parameters.go @@ -13,69 +13,69 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudIkepoliciesPutParams creates a new PcloudIkepoliciesPutParams object -// with the default values initialized. +// NewPcloudIkepoliciesPutParams creates a new PcloudIkepoliciesPutParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudIkepoliciesPutParams() *PcloudIkepoliciesPutParams { - var () return &PcloudIkepoliciesPutParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudIkepoliciesPutParamsWithTimeout creates a new PcloudIkepoliciesPutParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudIkepoliciesPutParamsWithTimeout(timeout time.Duration) *PcloudIkepoliciesPutParams { - var () return &PcloudIkepoliciesPutParams{ - timeout: timeout, } } // NewPcloudIkepoliciesPutParamsWithContext creates a new PcloudIkepoliciesPutParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudIkepoliciesPutParamsWithContext(ctx context.Context) *PcloudIkepoliciesPutParams { - var () return &PcloudIkepoliciesPutParams{ - Context: ctx, } } // NewPcloudIkepoliciesPutParamsWithHTTPClient creates a new PcloudIkepoliciesPutParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudIkepoliciesPutParamsWithHTTPClient(client *http.Client) *PcloudIkepoliciesPutParams { - var () return &PcloudIkepoliciesPutParams{ HTTPClient: client, } } -/*PcloudIkepoliciesPutParams contains all the parameters to send to the API endpoint -for the pcloud ikepolicies put operation typically these are written to a http.Request +/* PcloudIkepoliciesPutParams contains all the parameters to send to the API endpoint + for the pcloud ikepolicies put operation. + + Typically these are written to a http.Request. */ type PcloudIkepoliciesPutParams struct { - /*Body - Parameters for updating IKE Policy + /* Body. + Parameters for updating IKE Policy */ Body *models.IKEPolicyUpdate - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*IkePolicyID - ID of a IKE Policy + /* IkePolicyID. + + ID of a IKE Policy */ IkePolicyID string @@ -84,6 +84,21 @@ type PcloudIkepoliciesPutParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud ikepolicies put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIkepoliciesPutParams) WithDefaults() *PcloudIkepoliciesPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud ikepolicies put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIkepoliciesPutParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud ikepolicies put params func (o *PcloudIkepoliciesPutParams) WithTimeout(timeout time.Duration) *PcloudIkepoliciesPutParams { o.SetTimeout(timeout) @@ -157,7 +172,6 @@ func (o *PcloudIkepoliciesPutParams) WriteToRequest(r runtime.ClientRequest, reg return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_put_responses.go b/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_put_responses.go index f420045e..b9350c86 100644 --- a/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_put_responses.go +++ b/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_put_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudIkepoliciesPutReader is a Reader for the PcloudIkepoliciesPut structure. @@ -24,51 +23,44 @@ type PcloudIkepoliciesPutReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudIkepoliciesPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudIkepoliciesPutOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudIkepoliciesPutBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudIkepoliciesPutUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 403: result := NewPcloudIkepoliciesPutForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudIkepoliciesPutUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudIkepoliciesPutInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -77,7 +69,7 @@ func NewPcloudIkepoliciesPutOK() *PcloudIkepoliciesPutOK { return &PcloudIkepoliciesPutOK{} } -/*PcloudIkepoliciesPutOK handles this case with default header values. +/* PcloudIkepoliciesPutOK describes a response with status code 200, with default header values. OK */ @@ -88,6 +80,9 @@ type PcloudIkepoliciesPutOK struct { func (o *PcloudIkepoliciesPutOK) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesPutOK %+v", 200, o.Payload) } +func (o *PcloudIkepoliciesPutOK) GetPayload() *models.IKEPolicy { + return o.Payload +} func (o *PcloudIkepoliciesPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -106,7 +101,7 @@ func NewPcloudIkepoliciesPutBadRequest() *PcloudIkepoliciesPutBadRequest { return &PcloudIkepoliciesPutBadRequest{} } -/*PcloudIkepoliciesPutBadRequest handles this case with default header values. +/* PcloudIkepoliciesPutBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -117,6 +112,9 @@ type PcloudIkepoliciesPutBadRequest struct { func (o *PcloudIkepoliciesPutBadRequest) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesPutBadRequest %+v", 400, o.Payload) } +func (o *PcloudIkepoliciesPutBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIkepoliciesPutBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -135,7 +133,7 @@ func NewPcloudIkepoliciesPutUnauthorized() *PcloudIkepoliciesPutUnauthorized { return &PcloudIkepoliciesPutUnauthorized{} } -/*PcloudIkepoliciesPutUnauthorized handles this case with default header values. +/* PcloudIkepoliciesPutUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -146,6 +144,9 @@ type PcloudIkepoliciesPutUnauthorized struct { func (o *PcloudIkepoliciesPutUnauthorized) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesPutUnauthorized %+v", 401, o.Payload) } +func (o *PcloudIkepoliciesPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIkepoliciesPutUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -164,7 +165,7 @@ func NewPcloudIkepoliciesPutForbidden() *PcloudIkepoliciesPutForbidden { return &PcloudIkepoliciesPutForbidden{} } -/*PcloudIkepoliciesPutForbidden handles this case with default header values. +/* PcloudIkepoliciesPutForbidden describes a response with status code 403, with default header values. Forbidden */ @@ -175,6 +176,9 @@ type PcloudIkepoliciesPutForbidden struct { func (o *PcloudIkepoliciesPutForbidden) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesPutForbidden %+v", 403, o.Payload) } +func (o *PcloudIkepoliciesPutForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIkepoliciesPutForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -193,7 +197,7 @@ func NewPcloudIkepoliciesPutUnprocessableEntity() *PcloudIkepoliciesPutUnprocess return &PcloudIkepoliciesPutUnprocessableEntity{} } -/*PcloudIkepoliciesPutUnprocessableEntity handles this case with default header values. +/* PcloudIkepoliciesPutUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -204,6 +208,9 @@ type PcloudIkepoliciesPutUnprocessableEntity struct { func (o *PcloudIkepoliciesPutUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesPutUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudIkepoliciesPutUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIkepoliciesPutUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -222,7 +229,7 @@ func NewPcloudIkepoliciesPutInternalServerError() *PcloudIkepoliciesPutInternalS return &PcloudIkepoliciesPutInternalServerError{} } -/*PcloudIkepoliciesPutInternalServerError handles this case with default header values. +/* PcloudIkepoliciesPutInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -233,6 +240,9 @@ type PcloudIkepoliciesPutInternalServerError struct { func (o *PcloudIkepoliciesPutInternalServerError) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesPutInternalServerError %+v", 500, o.Payload) } +func (o *PcloudIkepoliciesPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIkepoliciesPutInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_delete_parameters.go b/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_delete_parameters.go index 8982b8b7..fdd67659 100644 --- a/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_delete_parameters.go +++ b/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_delete_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudIpsecpoliciesDeleteParams creates a new PcloudIpsecpoliciesDeleteParams object -// with the default values initialized. +// NewPcloudIpsecpoliciesDeleteParams creates a new PcloudIpsecpoliciesDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudIpsecpoliciesDeleteParams() *PcloudIpsecpoliciesDeleteParams { - var () return &PcloudIpsecpoliciesDeleteParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudIpsecpoliciesDeleteParamsWithTimeout creates a new PcloudIpsecpoliciesDeleteParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudIpsecpoliciesDeleteParamsWithTimeout(timeout time.Duration) *PcloudIpsecpoliciesDeleteParams { - var () return &PcloudIpsecpoliciesDeleteParams{ - timeout: timeout, } } // NewPcloudIpsecpoliciesDeleteParamsWithContext creates a new PcloudIpsecpoliciesDeleteParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudIpsecpoliciesDeleteParamsWithContext(ctx context.Context) *PcloudIpsecpoliciesDeleteParams { - var () return &PcloudIpsecpoliciesDeleteParams{ - Context: ctx, } } // NewPcloudIpsecpoliciesDeleteParamsWithHTTPClient creates a new PcloudIpsecpoliciesDeleteParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudIpsecpoliciesDeleteParamsWithHTTPClient(client *http.Client) *PcloudIpsecpoliciesDeleteParams { - var () return &PcloudIpsecpoliciesDeleteParams{ HTTPClient: client, } } -/*PcloudIpsecpoliciesDeleteParams contains all the parameters to send to the API endpoint -for the pcloud ipsecpolicies delete operation typically these are written to a http.Request +/* PcloudIpsecpoliciesDeleteParams contains all the parameters to send to the API endpoint + for the pcloud ipsecpolicies delete operation. + + Typically these are written to a http.Request. */ type PcloudIpsecpoliciesDeleteParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*IpsecPolicyID - ID of a IPSec Policy + /* IpsecPolicyID. + + ID of a IPSec Policy */ IpsecPolicyID string @@ -77,6 +76,21 @@ type PcloudIpsecpoliciesDeleteParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud ipsecpolicies delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIpsecpoliciesDeleteParams) WithDefaults() *PcloudIpsecpoliciesDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud ipsecpolicies delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIpsecpoliciesDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud ipsecpolicies delete params func (o *PcloudIpsecpoliciesDeleteParams) WithTimeout(timeout time.Duration) *PcloudIpsecpoliciesDeleteParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_delete_responses.go b/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_delete_responses.go index d0229fba..3c23530b 100644 --- a/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_delete_responses.go +++ b/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_delete_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudIpsecpoliciesDeleteReader is a Reader for the PcloudIpsecpoliciesDelete structure. @@ -24,44 +23,38 @@ type PcloudIpsecpoliciesDeleteReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudIpsecpoliciesDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudIpsecpoliciesDeleteOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudIpsecpoliciesDeleteBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudIpsecpoliciesDeleteUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 403: result := NewPcloudIpsecpoliciesDeleteForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudIpsecpoliciesDeleteInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudIpsecpoliciesDeleteOK() *PcloudIpsecpoliciesDeleteOK { return &PcloudIpsecpoliciesDeleteOK{} } -/*PcloudIpsecpoliciesDeleteOK handles this case with default header values. +/* PcloudIpsecpoliciesDeleteOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudIpsecpoliciesDeleteOK struct { func (o *PcloudIpsecpoliciesDeleteOK) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesDeleteOK %+v", 200, o.Payload) } +func (o *PcloudIpsecpoliciesDeleteOK) GetPayload() models.Object { + return o.Payload +} func (o *PcloudIpsecpoliciesDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -97,7 +93,7 @@ func NewPcloudIpsecpoliciesDeleteBadRequest() *PcloudIpsecpoliciesDeleteBadReque return &PcloudIpsecpoliciesDeleteBadRequest{} } -/*PcloudIpsecpoliciesDeleteBadRequest handles this case with default header values. +/* PcloudIpsecpoliciesDeleteBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -108,6 +104,9 @@ type PcloudIpsecpoliciesDeleteBadRequest struct { func (o *PcloudIpsecpoliciesDeleteBadRequest) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesDeleteBadRequest %+v", 400, o.Payload) } +func (o *PcloudIpsecpoliciesDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIpsecpoliciesDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -126,7 +125,7 @@ func NewPcloudIpsecpoliciesDeleteUnauthorized() *PcloudIpsecpoliciesDeleteUnauth return &PcloudIpsecpoliciesDeleteUnauthorized{} } -/*PcloudIpsecpoliciesDeleteUnauthorized handles this case with default header values. +/* PcloudIpsecpoliciesDeleteUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -137,6 +136,9 @@ type PcloudIpsecpoliciesDeleteUnauthorized struct { func (o *PcloudIpsecpoliciesDeleteUnauthorized) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesDeleteUnauthorized %+v", 401, o.Payload) } +func (o *PcloudIpsecpoliciesDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIpsecpoliciesDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -155,7 +157,7 @@ func NewPcloudIpsecpoliciesDeleteForbidden() *PcloudIpsecpoliciesDeleteForbidden return &PcloudIpsecpoliciesDeleteForbidden{} } -/*PcloudIpsecpoliciesDeleteForbidden handles this case with default header values. +/* PcloudIpsecpoliciesDeleteForbidden describes a response with status code 403, with default header values. Forbidden */ @@ -166,6 +168,9 @@ type PcloudIpsecpoliciesDeleteForbidden struct { func (o *PcloudIpsecpoliciesDeleteForbidden) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesDeleteForbidden %+v", 403, o.Payload) } +func (o *PcloudIpsecpoliciesDeleteForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIpsecpoliciesDeleteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -184,7 +189,7 @@ func NewPcloudIpsecpoliciesDeleteInternalServerError() *PcloudIpsecpoliciesDelet return &PcloudIpsecpoliciesDeleteInternalServerError{} } -/*PcloudIpsecpoliciesDeleteInternalServerError handles this case with default header values. +/* PcloudIpsecpoliciesDeleteInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -195,6 +200,9 @@ type PcloudIpsecpoliciesDeleteInternalServerError struct { func (o *PcloudIpsecpoliciesDeleteInternalServerError) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesDeleteInternalServerError %+v", 500, o.Payload) } +func (o *PcloudIpsecpoliciesDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIpsecpoliciesDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_get_parameters.go b/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_get_parameters.go index 82d7b1b5..8f24e703 100644 --- a/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_get_parameters.go +++ b/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_get_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudIpsecpoliciesGetParams creates a new PcloudIpsecpoliciesGetParams object -// with the default values initialized. +// NewPcloudIpsecpoliciesGetParams creates a new PcloudIpsecpoliciesGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudIpsecpoliciesGetParams() *PcloudIpsecpoliciesGetParams { - var () return &PcloudIpsecpoliciesGetParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudIpsecpoliciesGetParamsWithTimeout creates a new PcloudIpsecpoliciesGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudIpsecpoliciesGetParamsWithTimeout(timeout time.Duration) *PcloudIpsecpoliciesGetParams { - var () return &PcloudIpsecpoliciesGetParams{ - timeout: timeout, } } // NewPcloudIpsecpoliciesGetParamsWithContext creates a new PcloudIpsecpoliciesGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudIpsecpoliciesGetParamsWithContext(ctx context.Context) *PcloudIpsecpoliciesGetParams { - var () return &PcloudIpsecpoliciesGetParams{ - Context: ctx, } } // NewPcloudIpsecpoliciesGetParamsWithHTTPClient creates a new PcloudIpsecpoliciesGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudIpsecpoliciesGetParamsWithHTTPClient(client *http.Client) *PcloudIpsecpoliciesGetParams { - var () return &PcloudIpsecpoliciesGetParams{ HTTPClient: client, } } -/*PcloudIpsecpoliciesGetParams contains all the parameters to send to the API endpoint -for the pcloud ipsecpolicies get operation typically these are written to a http.Request +/* PcloudIpsecpoliciesGetParams contains all the parameters to send to the API endpoint + for the pcloud ipsecpolicies get operation. + + Typically these are written to a http.Request. */ type PcloudIpsecpoliciesGetParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*IpsecPolicyID - ID of a IPSec Policy + /* IpsecPolicyID. + + ID of a IPSec Policy */ IpsecPolicyID string @@ -77,6 +76,21 @@ type PcloudIpsecpoliciesGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud ipsecpolicies get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIpsecpoliciesGetParams) WithDefaults() *PcloudIpsecpoliciesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud ipsecpolicies get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIpsecpoliciesGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud ipsecpolicies get params func (o *PcloudIpsecpoliciesGetParams) WithTimeout(timeout time.Duration) *PcloudIpsecpoliciesGetParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_get_responses.go b/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_get_responses.go index 66ee77b4..2c51a8cd 100644 --- a/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_get_responses.go +++ b/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudIpsecpoliciesGetReader is a Reader for the PcloudIpsecpoliciesGet structure. @@ -24,51 +23,44 @@ type PcloudIpsecpoliciesGetReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudIpsecpoliciesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudIpsecpoliciesGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudIpsecpoliciesGetBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudIpsecpoliciesGetUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 403: result := NewPcloudIpsecpoliciesGetForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudIpsecpoliciesGetUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudIpsecpoliciesGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -77,7 +69,7 @@ func NewPcloudIpsecpoliciesGetOK() *PcloudIpsecpoliciesGetOK { return &PcloudIpsecpoliciesGetOK{} } -/*PcloudIpsecpoliciesGetOK handles this case with default header values. +/* PcloudIpsecpoliciesGetOK describes a response with status code 200, with default header values. OK */ @@ -88,6 +80,9 @@ type PcloudIpsecpoliciesGetOK struct { func (o *PcloudIpsecpoliciesGetOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesGetOK %+v", 200, o.Payload) } +func (o *PcloudIpsecpoliciesGetOK) GetPayload() *models.IPSecPolicy { + return o.Payload +} func (o *PcloudIpsecpoliciesGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -106,7 +101,7 @@ func NewPcloudIpsecpoliciesGetBadRequest() *PcloudIpsecpoliciesGetBadRequest { return &PcloudIpsecpoliciesGetBadRequest{} } -/*PcloudIpsecpoliciesGetBadRequest handles this case with default header values. +/* PcloudIpsecpoliciesGetBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -117,6 +112,9 @@ type PcloudIpsecpoliciesGetBadRequest struct { func (o *PcloudIpsecpoliciesGetBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesGetBadRequest %+v", 400, o.Payload) } +func (o *PcloudIpsecpoliciesGetBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIpsecpoliciesGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -135,7 +133,7 @@ func NewPcloudIpsecpoliciesGetUnauthorized() *PcloudIpsecpoliciesGetUnauthorized return &PcloudIpsecpoliciesGetUnauthorized{} } -/*PcloudIpsecpoliciesGetUnauthorized handles this case with default header values. +/* PcloudIpsecpoliciesGetUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -146,6 +144,9 @@ type PcloudIpsecpoliciesGetUnauthorized struct { func (o *PcloudIpsecpoliciesGetUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesGetUnauthorized %+v", 401, o.Payload) } +func (o *PcloudIpsecpoliciesGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIpsecpoliciesGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -164,7 +165,7 @@ func NewPcloudIpsecpoliciesGetForbidden() *PcloudIpsecpoliciesGetForbidden { return &PcloudIpsecpoliciesGetForbidden{} } -/*PcloudIpsecpoliciesGetForbidden handles this case with default header values. +/* PcloudIpsecpoliciesGetForbidden describes a response with status code 403, with default header values. Forbidden */ @@ -175,6 +176,9 @@ type PcloudIpsecpoliciesGetForbidden struct { func (o *PcloudIpsecpoliciesGetForbidden) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesGetForbidden %+v", 403, o.Payload) } +func (o *PcloudIpsecpoliciesGetForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIpsecpoliciesGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -193,7 +197,7 @@ func NewPcloudIpsecpoliciesGetUnprocessableEntity() *PcloudIpsecpoliciesGetUnpro return &PcloudIpsecpoliciesGetUnprocessableEntity{} } -/*PcloudIpsecpoliciesGetUnprocessableEntity handles this case with default header values. +/* PcloudIpsecpoliciesGetUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -204,6 +208,9 @@ type PcloudIpsecpoliciesGetUnprocessableEntity struct { func (o *PcloudIpsecpoliciesGetUnprocessableEntity) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesGetUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudIpsecpoliciesGetUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIpsecpoliciesGetUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -222,7 +229,7 @@ func NewPcloudIpsecpoliciesGetInternalServerError() *PcloudIpsecpoliciesGetInter return &PcloudIpsecpoliciesGetInternalServerError{} } -/*PcloudIpsecpoliciesGetInternalServerError handles this case with default header values. +/* PcloudIpsecpoliciesGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -233,6 +240,9 @@ type PcloudIpsecpoliciesGetInternalServerError struct { func (o *PcloudIpsecpoliciesGetInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesGetInternalServerError %+v", 500, o.Payload) } +func (o *PcloudIpsecpoliciesGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIpsecpoliciesGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_getall_parameters.go b/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_getall_parameters.go index 90d55411..6d9a00d3 100644 --- a/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_getall_parameters.go +++ b/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_getall_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudIpsecpoliciesGetallParams creates a new PcloudIpsecpoliciesGetallParams object -// with the default values initialized. +// NewPcloudIpsecpoliciesGetallParams creates a new PcloudIpsecpoliciesGetallParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudIpsecpoliciesGetallParams() *PcloudIpsecpoliciesGetallParams { - var () return &PcloudIpsecpoliciesGetallParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudIpsecpoliciesGetallParamsWithTimeout creates a new PcloudIpsecpoliciesGetallParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudIpsecpoliciesGetallParamsWithTimeout(timeout time.Duration) *PcloudIpsecpoliciesGetallParams { - var () return &PcloudIpsecpoliciesGetallParams{ - timeout: timeout, } } // NewPcloudIpsecpoliciesGetallParamsWithContext creates a new PcloudIpsecpoliciesGetallParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudIpsecpoliciesGetallParamsWithContext(ctx context.Context) *PcloudIpsecpoliciesGetallParams { - var () return &PcloudIpsecpoliciesGetallParams{ - Context: ctx, } } // NewPcloudIpsecpoliciesGetallParamsWithHTTPClient creates a new PcloudIpsecpoliciesGetallParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudIpsecpoliciesGetallParamsWithHTTPClient(client *http.Client) *PcloudIpsecpoliciesGetallParams { - var () return &PcloudIpsecpoliciesGetallParams{ HTTPClient: client, } } -/*PcloudIpsecpoliciesGetallParams contains all the parameters to send to the API endpoint -for the pcloud ipsecpolicies getall operation typically these are written to a http.Request +/* PcloudIpsecpoliciesGetallParams contains all the parameters to send to the API endpoint + for the pcloud ipsecpolicies getall operation. + + Typically these are written to a http.Request. */ type PcloudIpsecpoliciesGetallParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -72,6 +70,21 @@ type PcloudIpsecpoliciesGetallParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud ipsecpolicies getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIpsecpoliciesGetallParams) WithDefaults() *PcloudIpsecpoliciesGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud ipsecpolicies getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIpsecpoliciesGetallParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud ipsecpolicies getall params func (o *PcloudIpsecpoliciesGetallParams) WithTimeout(timeout time.Duration) *PcloudIpsecpoliciesGetallParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_getall_responses.go b/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_getall_responses.go index b09be973..92925b59 100644 --- a/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_getall_responses.go +++ b/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_getall_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudIpsecpoliciesGetallReader is a Reader for the PcloudIpsecpoliciesGetall structure. @@ -24,51 +23,44 @@ type PcloudIpsecpoliciesGetallReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudIpsecpoliciesGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudIpsecpoliciesGetallOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudIpsecpoliciesGetallBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudIpsecpoliciesGetallUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 403: result := NewPcloudIpsecpoliciesGetallForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudIpsecpoliciesGetallNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudIpsecpoliciesGetallInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -77,7 +69,7 @@ func NewPcloudIpsecpoliciesGetallOK() *PcloudIpsecpoliciesGetallOK { return &PcloudIpsecpoliciesGetallOK{} } -/*PcloudIpsecpoliciesGetallOK handles this case with default header values. +/* PcloudIpsecpoliciesGetallOK describes a response with status code 200, with default header values. OK */ @@ -88,6 +80,9 @@ type PcloudIpsecpoliciesGetallOK struct { func (o *PcloudIpsecpoliciesGetallOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies][%d] pcloudIpsecpoliciesGetallOK %+v", 200, o.Payload) } +func (o *PcloudIpsecpoliciesGetallOK) GetPayload() *models.IPSecPolicies { + return o.Payload +} func (o *PcloudIpsecpoliciesGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -106,7 +101,7 @@ func NewPcloudIpsecpoliciesGetallBadRequest() *PcloudIpsecpoliciesGetallBadReque return &PcloudIpsecpoliciesGetallBadRequest{} } -/*PcloudIpsecpoliciesGetallBadRequest handles this case with default header values. +/* PcloudIpsecpoliciesGetallBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -117,6 +112,9 @@ type PcloudIpsecpoliciesGetallBadRequest struct { func (o *PcloudIpsecpoliciesGetallBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies][%d] pcloudIpsecpoliciesGetallBadRequest %+v", 400, o.Payload) } +func (o *PcloudIpsecpoliciesGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIpsecpoliciesGetallBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -135,7 +133,7 @@ func NewPcloudIpsecpoliciesGetallUnauthorized() *PcloudIpsecpoliciesGetallUnauth return &PcloudIpsecpoliciesGetallUnauthorized{} } -/*PcloudIpsecpoliciesGetallUnauthorized handles this case with default header values. +/* PcloudIpsecpoliciesGetallUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -146,6 +144,9 @@ type PcloudIpsecpoliciesGetallUnauthorized struct { func (o *PcloudIpsecpoliciesGetallUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies][%d] pcloudIpsecpoliciesGetallUnauthorized %+v", 401, o.Payload) } +func (o *PcloudIpsecpoliciesGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIpsecpoliciesGetallUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -164,7 +165,7 @@ func NewPcloudIpsecpoliciesGetallForbidden() *PcloudIpsecpoliciesGetallForbidden return &PcloudIpsecpoliciesGetallForbidden{} } -/*PcloudIpsecpoliciesGetallForbidden handles this case with default header values. +/* PcloudIpsecpoliciesGetallForbidden describes a response with status code 403, with default header values. Forbidden */ @@ -175,6 +176,9 @@ type PcloudIpsecpoliciesGetallForbidden struct { func (o *PcloudIpsecpoliciesGetallForbidden) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies][%d] pcloudIpsecpoliciesGetallForbidden %+v", 403, o.Payload) } +func (o *PcloudIpsecpoliciesGetallForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIpsecpoliciesGetallForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -193,7 +197,7 @@ func NewPcloudIpsecpoliciesGetallNotFound() *PcloudIpsecpoliciesGetallNotFound { return &PcloudIpsecpoliciesGetallNotFound{} } -/*PcloudIpsecpoliciesGetallNotFound handles this case with default header values. +/* PcloudIpsecpoliciesGetallNotFound describes a response with status code 404, with default header values. Not Found */ @@ -204,6 +208,9 @@ type PcloudIpsecpoliciesGetallNotFound struct { func (o *PcloudIpsecpoliciesGetallNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies][%d] pcloudIpsecpoliciesGetallNotFound %+v", 404, o.Payload) } +func (o *PcloudIpsecpoliciesGetallNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIpsecpoliciesGetallNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -222,7 +229,7 @@ func NewPcloudIpsecpoliciesGetallInternalServerError() *PcloudIpsecpoliciesGetal return &PcloudIpsecpoliciesGetallInternalServerError{} } -/*PcloudIpsecpoliciesGetallInternalServerError handles this case with default header values. +/* PcloudIpsecpoliciesGetallInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -233,6 +240,9 @@ type PcloudIpsecpoliciesGetallInternalServerError struct { func (o *PcloudIpsecpoliciesGetallInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies][%d] pcloudIpsecpoliciesGetallInternalServerError %+v", 500, o.Payload) } +func (o *PcloudIpsecpoliciesGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIpsecpoliciesGetallInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_post_parameters.go b/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_post_parameters.go index 303aceb3..a09d4300 100644 --- a/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_post_parameters.go +++ b/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_post_parameters.go @@ -13,64 +13,63 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudIpsecpoliciesPostParams creates a new PcloudIpsecpoliciesPostParams object -// with the default values initialized. +// NewPcloudIpsecpoliciesPostParams creates a new PcloudIpsecpoliciesPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudIpsecpoliciesPostParams() *PcloudIpsecpoliciesPostParams { - var () return &PcloudIpsecpoliciesPostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudIpsecpoliciesPostParamsWithTimeout creates a new PcloudIpsecpoliciesPostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudIpsecpoliciesPostParamsWithTimeout(timeout time.Duration) *PcloudIpsecpoliciesPostParams { - var () return &PcloudIpsecpoliciesPostParams{ - timeout: timeout, } } // NewPcloudIpsecpoliciesPostParamsWithContext creates a new PcloudIpsecpoliciesPostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudIpsecpoliciesPostParamsWithContext(ctx context.Context) *PcloudIpsecpoliciesPostParams { - var () return &PcloudIpsecpoliciesPostParams{ - Context: ctx, } } // NewPcloudIpsecpoliciesPostParamsWithHTTPClient creates a new PcloudIpsecpoliciesPostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudIpsecpoliciesPostParamsWithHTTPClient(client *http.Client) *PcloudIpsecpoliciesPostParams { - var () return &PcloudIpsecpoliciesPostParams{ HTTPClient: client, } } -/*PcloudIpsecpoliciesPostParams contains all the parameters to send to the API endpoint -for the pcloud ipsecpolicies post operation typically these are written to a http.Request +/* PcloudIpsecpoliciesPostParams contains all the parameters to send to the API endpoint + for the pcloud ipsecpolicies post operation. + + Typically these are written to a http.Request. */ type PcloudIpsecpoliciesPostParams struct { - /*Body - Parameters for the creation of a new IPSec Policy + /* Body. + Parameters for the creation of a new IPSec Policy */ Body *models.IPSecPolicyCreate - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -79,6 +78,21 @@ type PcloudIpsecpoliciesPostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud ipsecpolicies post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIpsecpoliciesPostParams) WithDefaults() *PcloudIpsecpoliciesPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud ipsecpolicies post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIpsecpoliciesPostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud ipsecpolicies post params func (o *PcloudIpsecpoliciesPostParams) WithTimeout(timeout time.Duration) *PcloudIpsecpoliciesPostParams { o.SetTimeout(timeout) @@ -141,7 +155,6 @@ func (o *PcloudIpsecpoliciesPostParams) WriteToRequest(r runtime.ClientRequest, return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_post_responses.go b/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_post_responses.go index eae76371..20620cea 100644 --- a/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_post_responses.go +++ b/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudIpsecpoliciesPostReader is a Reader for the PcloudIpsecpoliciesPost structure. @@ -24,58 +23,50 @@ type PcloudIpsecpoliciesPostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudIpsecpoliciesPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudIpsecpoliciesPostOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudIpsecpoliciesPostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudIpsecpoliciesPostUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 403: result := NewPcloudIpsecpoliciesPostForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 409: result := NewPcloudIpsecpoliciesPostConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudIpsecpoliciesPostUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudIpsecpoliciesPostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -84,7 +75,7 @@ func NewPcloudIpsecpoliciesPostOK() *PcloudIpsecpoliciesPostOK { return &PcloudIpsecpoliciesPostOK{} } -/*PcloudIpsecpoliciesPostOK handles this case with default header values. +/* PcloudIpsecpoliciesPostOK describes a response with status code 200, with default header values. OK */ @@ -95,6 +86,9 @@ type PcloudIpsecpoliciesPostOK struct { func (o *PcloudIpsecpoliciesPostOK) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies][%d] pcloudIpsecpoliciesPostOK %+v", 200, o.Payload) } +func (o *PcloudIpsecpoliciesPostOK) GetPayload() *models.IPSecPolicy { + return o.Payload +} func (o *PcloudIpsecpoliciesPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -113,7 +107,7 @@ func NewPcloudIpsecpoliciesPostBadRequest() *PcloudIpsecpoliciesPostBadRequest { return &PcloudIpsecpoliciesPostBadRequest{} } -/*PcloudIpsecpoliciesPostBadRequest handles this case with default header values. +/* PcloudIpsecpoliciesPostBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -124,6 +118,9 @@ type PcloudIpsecpoliciesPostBadRequest struct { func (o *PcloudIpsecpoliciesPostBadRequest) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies][%d] pcloudIpsecpoliciesPostBadRequest %+v", 400, o.Payload) } +func (o *PcloudIpsecpoliciesPostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIpsecpoliciesPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -142,7 +139,7 @@ func NewPcloudIpsecpoliciesPostUnauthorized() *PcloudIpsecpoliciesPostUnauthoriz return &PcloudIpsecpoliciesPostUnauthorized{} } -/*PcloudIpsecpoliciesPostUnauthorized handles this case with default header values. +/* PcloudIpsecpoliciesPostUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -153,6 +150,9 @@ type PcloudIpsecpoliciesPostUnauthorized struct { func (o *PcloudIpsecpoliciesPostUnauthorized) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies][%d] pcloudIpsecpoliciesPostUnauthorized %+v", 401, o.Payload) } +func (o *PcloudIpsecpoliciesPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIpsecpoliciesPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -171,7 +171,7 @@ func NewPcloudIpsecpoliciesPostForbidden() *PcloudIpsecpoliciesPostForbidden { return &PcloudIpsecpoliciesPostForbidden{} } -/*PcloudIpsecpoliciesPostForbidden handles this case with default header values. +/* PcloudIpsecpoliciesPostForbidden describes a response with status code 403, with default header values. Forbidden */ @@ -182,6 +182,9 @@ type PcloudIpsecpoliciesPostForbidden struct { func (o *PcloudIpsecpoliciesPostForbidden) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies][%d] pcloudIpsecpoliciesPostForbidden %+v", 403, o.Payload) } +func (o *PcloudIpsecpoliciesPostForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIpsecpoliciesPostForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -200,7 +203,7 @@ func NewPcloudIpsecpoliciesPostConflict() *PcloudIpsecpoliciesPostConflict { return &PcloudIpsecpoliciesPostConflict{} } -/*PcloudIpsecpoliciesPostConflict handles this case with default header values. +/* PcloudIpsecpoliciesPostConflict describes a response with status code 409, with default header values. Conflict */ @@ -211,6 +214,9 @@ type PcloudIpsecpoliciesPostConflict struct { func (o *PcloudIpsecpoliciesPostConflict) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies][%d] pcloudIpsecpoliciesPostConflict %+v", 409, o.Payload) } +func (o *PcloudIpsecpoliciesPostConflict) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIpsecpoliciesPostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -229,7 +235,7 @@ func NewPcloudIpsecpoliciesPostUnprocessableEntity() *PcloudIpsecpoliciesPostUnp return &PcloudIpsecpoliciesPostUnprocessableEntity{} } -/*PcloudIpsecpoliciesPostUnprocessableEntity handles this case with default header values. +/* PcloudIpsecpoliciesPostUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -240,6 +246,9 @@ type PcloudIpsecpoliciesPostUnprocessableEntity struct { func (o *PcloudIpsecpoliciesPostUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies][%d] pcloudIpsecpoliciesPostUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudIpsecpoliciesPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIpsecpoliciesPostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -258,7 +267,7 @@ func NewPcloudIpsecpoliciesPostInternalServerError() *PcloudIpsecpoliciesPostInt return &PcloudIpsecpoliciesPostInternalServerError{} } -/*PcloudIpsecpoliciesPostInternalServerError handles this case with default header values. +/* PcloudIpsecpoliciesPostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -269,6 +278,9 @@ type PcloudIpsecpoliciesPostInternalServerError struct { func (o *PcloudIpsecpoliciesPostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies][%d] pcloudIpsecpoliciesPostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudIpsecpoliciesPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIpsecpoliciesPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_put_parameters.go b/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_put_parameters.go index 29df9569..4849277e 100644 --- a/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_put_parameters.go +++ b/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_put_parameters.go @@ -13,69 +13,69 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudIpsecpoliciesPutParams creates a new PcloudIpsecpoliciesPutParams object -// with the default values initialized. +// NewPcloudIpsecpoliciesPutParams creates a new PcloudIpsecpoliciesPutParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudIpsecpoliciesPutParams() *PcloudIpsecpoliciesPutParams { - var () return &PcloudIpsecpoliciesPutParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudIpsecpoliciesPutParamsWithTimeout creates a new PcloudIpsecpoliciesPutParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudIpsecpoliciesPutParamsWithTimeout(timeout time.Duration) *PcloudIpsecpoliciesPutParams { - var () return &PcloudIpsecpoliciesPutParams{ - timeout: timeout, } } // NewPcloudIpsecpoliciesPutParamsWithContext creates a new PcloudIpsecpoliciesPutParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudIpsecpoliciesPutParamsWithContext(ctx context.Context) *PcloudIpsecpoliciesPutParams { - var () return &PcloudIpsecpoliciesPutParams{ - Context: ctx, } } // NewPcloudIpsecpoliciesPutParamsWithHTTPClient creates a new PcloudIpsecpoliciesPutParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudIpsecpoliciesPutParamsWithHTTPClient(client *http.Client) *PcloudIpsecpoliciesPutParams { - var () return &PcloudIpsecpoliciesPutParams{ HTTPClient: client, } } -/*PcloudIpsecpoliciesPutParams contains all the parameters to send to the API endpoint -for the pcloud ipsecpolicies put operation typically these are written to a http.Request +/* PcloudIpsecpoliciesPutParams contains all the parameters to send to the API endpoint + for the pcloud ipsecpolicies put operation. + + Typically these are written to a http.Request. */ type PcloudIpsecpoliciesPutParams struct { - /*Body - Parameters for the update of an IPSec Policy + /* Body. + Parameters for the update of an IPSec Policy */ Body *models.IPSecPolicyUpdate - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*IpsecPolicyID - ID of a IPSec Policy + /* IpsecPolicyID. + + ID of a IPSec Policy */ IpsecPolicyID string @@ -84,6 +84,21 @@ type PcloudIpsecpoliciesPutParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud ipsecpolicies put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIpsecpoliciesPutParams) WithDefaults() *PcloudIpsecpoliciesPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud ipsecpolicies put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIpsecpoliciesPutParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud ipsecpolicies put params func (o *PcloudIpsecpoliciesPutParams) WithTimeout(timeout time.Duration) *PcloudIpsecpoliciesPutParams { o.SetTimeout(timeout) @@ -157,7 +172,6 @@ func (o *PcloudIpsecpoliciesPutParams) WriteToRequest(r runtime.ClientRequest, r return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_put_responses.go b/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_put_responses.go index bf216440..feb15131 100644 --- a/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_put_responses.go +++ b/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_put_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudIpsecpoliciesPutReader is a Reader for the PcloudIpsecpoliciesPut structure. @@ -24,58 +23,50 @@ type PcloudIpsecpoliciesPutReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudIpsecpoliciesPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudIpsecpoliciesPutOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudIpsecpoliciesPutBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudIpsecpoliciesPutUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 403: result := NewPcloudIpsecpoliciesPutForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 409: result := NewPcloudIpsecpoliciesPutConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudIpsecpoliciesPutUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudIpsecpoliciesPutInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -84,7 +75,7 @@ func NewPcloudIpsecpoliciesPutOK() *PcloudIpsecpoliciesPutOK { return &PcloudIpsecpoliciesPutOK{} } -/*PcloudIpsecpoliciesPutOK handles this case with default header values. +/* PcloudIpsecpoliciesPutOK describes a response with status code 200, with default header values. OK */ @@ -95,6 +86,9 @@ type PcloudIpsecpoliciesPutOK struct { func (o *PcloudIpsecpoliciesPutOK) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesPutOK %+v", 200, o.Payload) } +func (o *PcloudIpsecpoliciesPutOK) GetPayload() *models.IPSecPolicy { + return o.Payload +} func (o *PcloudIpsecpoliciesPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -113,7 +107,7 @@ func NewPcloudIpsecpoliciesPutBadRequest() *PcloudIpsecpoliciesPutBadRequest { return &PcloudIpsecpoliciesPutBadRequest{} } -/*PcloudIpsecpoliciesPutBadRequest handles this case with default header values. +/* PcloudIpsecpoliciesPutBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -124,6 +118,9 @@ type PcloudIpsecpoliciesPutBadRequest struct { func (o *PcloudIpsecpoliciesPutBadRequest) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesPutBadRequest %+v", 400, o.Payload) } +func (o *PcloudIpsecpoliciesPutBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIpsecpoliciesPutBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -142,7 +139,7 @@ func NewPcloudIpsecpoliciesPutUnauthorized() *PcloudIpsecpoliciesPutUnauthorized return &PcloudIpsecpoliciesPutUnauthorized{} } -/*PcloudIpsecpoliciesPutUnauthorized handles this case with default header values. +/* PcloudIpsecpoliciesPutUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -153,6 +150,9 @@ type PcloudIpsecpoliciesPutUnauthorized struct { func (o *PcloudIpsecpoliciesPutUnauthorized) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesPutUnauthorized %+v", 401, o.Payload) } +func (o *PcloudIpsecpoliciesPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIpsecpoliciesPutUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -171,7 +171,7 @@ func NewPcloudIpsecpoliciesPutForbidden() *PcloudIpsecpoliciesPutForbidden { return &PcloudIpsecpoliciesPutForbidden{} } -/*PcloudIpsecpoliciesPutForbidden handles this case with default header values. +/* PcloudIpsecpoliciesPutForbidden describes a response with status code 403, with default header values. Forbidden */ @@ -182,6 +182,9 @@ type PcloudIpsecpoliciesPutForbidden struct { func (o *PcloudIpsecpoliciesPutForbidden) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesPutForbidden %+v", 403, o.Payload) } +func (o *PcloudIpsecpoliciesPutForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIpsecpoliciesPutForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -200,7 +203,7 @@ func NewPcloudIpsecpoliciesPutConflict() *PcloudIpsecpoliciesPutConflict { return &PcloudIpsecpoliciesPutConflict{} } -/*PcloudIpsecpoliciesPutConflict handles this case with default header values. +/* PcloudIpsecpoliciesPutConflict describes a response with status code 409, with default header values. Conflict */ @@ -211,6 +214,9 @@ type PcloudIpsecpoliciesPutConflict struct { func (o *PcloudIpsecpoliciesPutConflict) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesPutConflict %+v", 409, o.Payload) } +func (o *PcloudIpsecpoliciesPutConflict) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIpsecpoliciesPutConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -229,7 +235,7 @@ func NewPcloudIpsecpoliciesPutUnprocessableEntity() *PcloudIpsecpoliciesPutUnpro return &PcloudIpsecpoliciesPutUnprocessableEntity{} } -/*PcloudIpsecpoliciesPutUnprocessableEntity handles this case with default header values. +/* PcloudIpsecpoliciesPutUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -240,6 +246,9 @@ type PcloudIpsecpoliciesPutUnprocessableEntity struct { func (o *PcloudIpsecpoliciesPutUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesPutUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudIpsecpoliciesPutUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIpsecpoliciesPutUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -258,7 +267,7 @@ func NewPcloudIpsecpoliciesPutInternalServerError() *PcloudIpsecpoliciesPutInter return &PcloudIpsecpoliciesPutInternalServerError{} } -/*PcloudIpsecpoliciesPutInternalServerError handles this case with default header values. +/* PcloudIpsecpoliciesPutInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -269,6 +278,9 @@ type PcloudIpsecpoliciesPutInternalServerError struct { func (o *PcloudIpsecpoliciesPutInternalServerError) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesPutInternalServerError %+v", 500, o.Payload) } +func (o *PcloudIpsecpoliciesPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudIpsecpoliciesPutInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_volumes/p_cloud_volumes_client.go b/power/client/p_cloud_volumes/p_cloud_volumes_client.go index 0ef37d9e..d0afc8f4 100644 --- a/power/client/p_cloud_volumes/p_cloud_volumes_client.go +++ b/power/client/p_cloud_volumes/p_cloud_volumes_client.go @@ -6,13 +6,14 @@ package p_cloud_volumes // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/runtime" + "fmt" - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" ) // New creates a new p cloud volumes API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { return &Client{transport: transport, formats: formats} } @@ -24,16 +25,71 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudCloudinstancesVolumesActionPost(params *PcloudCloudinstancesVolumesActionPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesVolumesActionPostAccepted, error) + + PcloudCloudinstancesVolumesDelete(params *PcloudCloudinstancesVolumesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesVolumesDeleteOK, error) + + PcloudCloudinstancesVolumesGet(params *PcloudCloudinstancesVolumesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesVolumesGetOK, error) + + PcloudCloudinstancesVolumesGetall(params *PcloudCloudinstancesVolumesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesVolumesGetallOK, error) + + PcloudCloudinstancesVolumesPost(params *PcloudCloudinstancesVolumesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesVolumesPostAccepted, error) + + PcloudCloudinstancesVolumesPut(params *PcloudCloudinstancesVolumesPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesVolumesPutOK, error) + + PcloudPvminstancesVolumesDelete(params *PcloudPvminstancesVolumesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVolumesDeleteAccepted, error) + + PcloudPvminstancesVolumesGet(params *PcloudPvminstancesVolumesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVolumesGetOK, error) + + PcloudPvminstancesVolumesGetall(params *PcloudPvminstancesVolumesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVolumesGetallOK, error) + + PcloudPvminstancesVolumesPost(params *PcloudPvminstancesVolumesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVolumesPostOK, error) + + PcloudPvminstancesVolumesPut(params *PcloudPvminstancesVolumesPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVolumesPutOK, error) + + PcloudPvminstancesVolumesSetbootPut(params *PcloudPvminstancesVolumesSetbootPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVolumesSetbootPutOK, error) + + PcloudV2PvminstancesVolumesPost(params *PcloudV2PvminstancesVolumesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2PvminstancesVolumesPostAccepted, error) + + PcloudV2VolumesClonePost(params *PcloudV2VolumesClonePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumesClonePostAccepted, error) + + PcloudV2VolumesClonetasksGet(params *PcloudV2VolumesClonetasksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumesClonetasksGetOK, error) + + PcloudV2VolumesPost(params *PcloudV2VolumesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumesPostCreated, error) + + PcloudV2VolumescloneCancelPost(params *PcloudV2VolumescloneCancelPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumescloneCancelPostAccepted, error) + + PcloudV2VolumescloneDelete(params *PcloudV2VolumescloneDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumescloneDeleteOK, error) + + PcloudV2VolumescloneExecutePost(params *PcloudV2VolumescloneExecutePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumescloneExecutePostAccepted, error) + + PcloudV2VolumescloneGet(params *PcloudV2VolumescloneGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumescloneGetOK, error) + + PcloudV2VolumescloneGetall(params *PcloudV2VolumescloneGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumescloneGetallOK, error) + + PcloudV2VolumesclonePost(params *PcloudV2VolumesclonePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumesclonePostAccepted, error) + + PcloudV2VolumescloneStartPost(params *PcloudV2VolumescloneStartPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumescloneStartPostOK, error) + + PcloudVolumesClonePost(params *PcloudVolumesClonePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVolumesClonePostOK, error) + + SetTransport(transport runtime.ClientTransport) +} + /* -PcloudCloudinstancesVolumesActionPost performs an action on a volume + PcloudCloudinstancesVolumesActionPost performs an action on a volume */ -func (a *Client) PcloudCloudinstancesVolumesActionPost(params *PcloudCloudinstancesVolumesActionPostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudCloudinstancesVolumesActionPostAccepted, error) { +func (a *Client) PcloudCloudinstancesVolumesActionPost(params *PcloudCloudinstancesVolumesActionPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesVolumesActionPostAccepted, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudCloudinstancesVolumesActionPostParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.cloudinstances.volumes.action.post", Method: "POST", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}/action", @@ -45,24 +101,34 @@ func (a *Client) PcloudCloudinstancesVolumesActionPost(params *PcloudCloudinstan AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudCloudinstancesVolumesActionPostAccepted), nil - + success, ok := result.(*PcloudCloudinstancesVolumesActionPostAccepted) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.cloudinstances.volumes.action.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudCloudinstancesVolumesDelete deletes a cloud instance volume + PcloudCloudinstancesVolumesDelete deletes a cloud instance volume */ -func (a *Client) PcloudCloudinstancesVolumesDelete(params *PcloudCloudinstancesVolumesDeleteParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudCloudinstancesVolumesDeleteOK, error) { +func (a *Client) PcloudCloudinstancesVolumesDelete(params *PcloudCloudinstancesVolumesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesVolumesDeleteOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudCloudinstancesVolumesDeleteParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.cloudinstances.volumes.delete", Method: "DELETE", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}", @@ -74,24 +140,34 @@ func (a *Client) PcloudCloudinstancesVolumesDelete(params *PcloudCloudinstancesV AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudCloudinstancesVolumesDeleteOK), nil - + success, ok := result.(*PcloudCloudinstancesVolumesDeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.cloudinstances.volumes.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudCloudinstancesVolumesGet detaileds info of a volume + PcloudCloudinstancesVolumesGet detaileds info of a volume */ -func (a *Client) PcloudCloudinstancesVolumesGet(params *PcloudCloudinstancesVolumesGetParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudCloudinstancesVolumesGetOK, error) { +func (a *Client) PcloudCloudinstancesVolumesGet(params *PcloudCloudinstancesVolumesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesVolumesGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudCloudinstancesVolumesGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.cloudinstances.volumes.get", Method: "GET", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}", @@ -103,24 +179,34 @@ func (a *Client) PcloudCloudinstancesVolumesGet(params *PcloudCloudinstancesVolu AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudCloudinstancesVolumesGetOK), nil - + success, ok := result.(*PcloudCloudinstancesVolumesGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.cloudinstances.volumes.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudCloudinstancesVolumesGetall lists all volumes for this cloud instance + PcloudCloudinstancesVolumesGetall lists all volumes for this cloud instance */ -func (a *Client) PcloudCloudinstancesVolumesGetall(params *PcloudCloudinstancesVolumesGetallParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudCloudinstancesVolumesGetallOK, error) { +func (a *Client) PcloudCloudinstancesVolumesGetall(params *PcloudCloudinstancesVolumesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesVolumesGetallOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudCloudinstancesVolumesGetallParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.cloudinstances.volumes.getall", Method: "GET", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/volumes", @@ -132,24 +218,34 @@ func (a *Client) PcloudCloudinstancesVolumesGetall(params *PcloudCloudinstancesV AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudCloudinstancesVolumesGetallOK), nil - + success, ok := result.(*PcloudCloudinstancesVolumesGetallOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.cloudinstances.volumes.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudCloudinstancesVolumesPost creates a new data volume + PcloudCloudinstancesVolumesPost creates a new data volume */ -func (a *Client) PcloudCloudinstancesVolumesPost(params *PcloudCloudinstancesVolumesPostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudCloudinstancesVolumesPostAccepted, error) { +func (a *Client) PcloudCloudinstancesVolumesPost(params *PcloudCloudinstancesVolumesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesVolumesPostAccepted, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudCloudinstancesVolumesPostParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.cloudinstances.volumes.post", Method: "POST", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/volumes", @@ -161,24 +257,34 @@ func (a *Client) PcloudCloudinstancesVolumesPost(params *PcloudCloudinstancesVol AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudCloudinstancesVolumesPostAccepted), nil - + success, ok := result.(*PcloudCloudinstancesVolumesPostAccepted) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.cloudinstances.volumes.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudCloudinstancesVolumesPut updates a cloud instance volume + PcloudCloudinstancesVolumesPut updates a cloud instance volume */ -func (a *Client) PcloudCloudinstancesVolumesPut(params *PcloudCloudinstancesVolumesPutParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudCloudinstancesVolumesPutOK, error) { +func (a *Client) PcloudCloudinstancesVolumesPut(params *PcloudCloudinstancesVolumesPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesVolumesPutOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudCloudinstancesVolumesPutParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.cloudinstances.volumes.put", Method: "PUT", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}", @@ -190,24 +296,34 @@ func (a *Client) PcloudCloudinstancesVolumesPut(params *PcloudCloudinstancesVolu AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudCloudinstancesVolumesPutOK), nil - + success, ok := result.(*PcloudCloudinstancesVolumesPutOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.cloudinstances.volumes.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudPvminstancesVolumesDelete detaches a volume from a p VM instance + PcloudPvminstancesVolumesDelete detaches a volume from a p VM instance */ -func (a *Client) PcloudPvminstancesVolumesDelete(params *PcloudPvminstancesVolumesDeleteParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudPvminstancesVolumesDeleteAccepted, error) { +func (a *Client) PcloudPvminstancesVolumesDelete(params *PcloudPvminstancesVolumesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVolumesDeleteAccepted, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudPvminstancesVolumesDeleteParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.pvminstances.volumes.delete", Method: "DELETE", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}", @@ -219,24 +335,34 @@ func (a *Client) PcloudPvminstancesVolumesDelete(params *PcloudPvminstancesVolum AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudPvminstancesVolumesDeleteAccepted), nil - + success, ok := result.(*PcloudPvminstancesVolumesDeleteAccepted) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.pvminstances.volumes.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudPvminstancesVolumesGet detaileds info of a volume attached to a p VM instance + PcloudPvminstancesVolumesGet detaileds info of a volume attached to a p VM instance */ -func (a *Client) PcloudPvminstancesVolumesGet(params *PcloudPvminstancesVolumesGetParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudPvminstancesVolumesGetOK, error) { +func (a *Client) PcloudPvminstancesVolumesGet(params *PcloudPvminstancesVolumesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVolumesGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudPvminstancesVolumesGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.pvminstances.volumes.get", Method: "GET", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}", @@ -248,24 +374,34 @@ func (a *Client) PcloudPvminstancesVolumesGet(params *PcloudPvminstancesVolumesG AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudPvminstancesVolumesGetOK), nil - + success, ok := result.(*PcloudPvminstancesVolumesGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.pvminstances.volumes.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudPvminstancesVolumesGetall lists all volumes attached to a p VM instance + PcloudPvminstancesVolumesGetall lists all volumes attached to a p VM instance */ -func (a *Client) PcloudPvminstancesVolumesGetall(params *PcloudPvminstancesVolumesGetallParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudPvminstancesVolumesGetallOK, error) { +func (a *Client) PcloudPvminstancesVolumesGetall(params *PcloudPvminstancesVolumesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVolumesGetallOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudPvminstancesVolumesGetallParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.pvminstances.volumes.getall", Method: "GET", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes", @@ -277,24 +413,34 @@ func (a *Client) PcloudPvminstancesVolumesGetall(params *PcloudPvminstancesVolum AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudPvminstancesVolumesGetallOK), nil - + success, ok := result.(*PcloudPvminstancesVolumesGetallOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.pvminstances.volumes.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudPvminstancesVolumesPost attaches a volume to a p VM instance + PcloudPvminstancesVolumesPost attaches a volume to a p VM instance */ -func (a *Client) PcloudPvminstancesVolumesPost(params *PcloudPvminstancesVolumesPostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudPvminstancesVolumesPostOK, error) { +func (a *Client) PcloudPvminstancesVolumesPost(params *PcloudPvminstancesVolumesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVolumesPostOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudPvminstancesVolumesPostParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.pvminstances.volumes.post", Method: "POST", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}", @@ -306,24 +452,34 @@ func (a *Client) PcloudPvminstancesVolumesPost(params *PcloudPvminstancesVolumes AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudPvminstancesVolumesPostOK), nil - + success, ok := result.(*PcloudPvminstancesVolumesPostOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.pvminstances.volumes.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudPvminstancesVolumesPut updates a volume attached to a p VM instance + PcloudPvminstancesVolumesPut updates a volume attached to a p VM instance */ -func (a *Client) PcloudPvminstancesVolumesPut(params *PcloudPvminstancesVolumesPutParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudPvminstancesVolumesPutOK, error) { +func (a *Client) PcloudPvminstancesVolumesPut(params *PcloudPvminstancesVolumesPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVolumesPutOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudPvminstancesVolumesPutParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.pvminstances.volumes.put", Method: "PUT", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}", @@ -335,24 +491,34 @@ func (a *Client) PcloudPvminstancesVolumesPut(params *PcloudPvminstancesVolumesP AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudPvminstancesVolumesPutOK), nil - + success, ok := result.(*PcloudPvminstancesVolumesPutOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.pvminstances.volumes.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudPvminstancesVolumesSetbootPut sets the p VM instance volume as the boot volume + PcloudPvminstancesVolumesSetbootPut sets the p VM instance volume as the boot volume */ -func (a *Client) PcloudPvminstancesVolumesSetbootPut(params *PcloudPvminstancesVolumesSetbootPutParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudPvminstancesVolumesSetbootPutOK, error) { +func (a *Client) PcloudPvminstancesVolumesSetbootPut(params *PcloudPvminstancesVolumesSetbootPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVolumesSetbootPutOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudPvminstancesVolumesSetbootPutParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.pvminstances.volumes.setboot.put", Method: "PUT", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}/setboot", @@ -364,24 +530,34 @@ func (a *Client) PcloudPvminstancesVolumesSetbootPut(params *PcloudPvminstancesV AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudPvminstancesVolumesSetbootPutOK), nil - + success, ok := result.(*PcloudPvminstancesVolumesSetbootPutOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.pvminstances.volumes.setboot.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudV2PvminstancesVolumesPost attaches all volumes to a p VM instance + PcloudV2PvminstancesVolumesPost attaches all volumes to a p VM instance */ -func (a *Client) PcloudV2PvminstancesVolumesPost(params *PcloudV2PvminstancesVolumesPostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudV2PvminstancesVolumesPostAccepted, error) { +func (a *Client) PcloudV2PvminstancesVolumesPost(params *PcloudV2PvminstancesVolumesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2PvminstancesVolumesPostAccepted, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudV2PvminstancesVolumesPostParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.v2.pvminstances.volumes.post", Method: "POST", PathPattern: "/pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes", @@ -393,24 +569,34 @@ func (a *Client) PcloudV2PvminstancesVolumesPost(params *PcloudV2PvminstancesVol AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudV2PvminstancesVolumesPostAccepted), nil - + success, ok := result.(*PcloudV2PvminstancesVolumesPostAccepted) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.v2.pvminstances.volumes.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudV2VolumesClonePost creates a volume clone for specified volumes + PcloudV2VolumesClonePost creates a volume clone for specified volumes */ -func (a *Client) PcloudV2VolumesClonePost(params *PcloudV2VolumesClonePostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudV2VolumesClonePostAccepted, error) { +func (a *Client) PcloudV2VolumesClonePost(params *PcloudV2VolumesClonePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumesClonePostAccepted, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudV2VolumesClonePostParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.v2.volumes.clone.post", Method: "POST", PathPattern: "/pcloud/v2/cloud-instances/{cloud_instance_id}/volumes/clone", @@ -422,24 +608,34 @@ func (a *Client) PcloudV2VolumesClonePost(params *PcloudV2VolumesClonePostParams AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudV2VolumesClonePostAccepted), nil - + success, ok := result.(*PcloudV2VolumesClonePostAccepted) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.v2.volumes.clone.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudV2VolumesClonetasksGet gets the status of a volumes clone request for the specified clone task ID + PcloudV2VolumesClonetasksGet gets the status of a volumes clone request for the specified clone task ID */ -func (a *Client) PcloudV2VolumesClonetasksGet(params *PcloudV2VolumesClonetasksGetParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudV2VolumesClonetasksGetOK, error) { +func (a *Client) PcloudV2VolumesClonetasksGet(params *PcloudV2VolumesClonetasksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumesClonetasksGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudV2VolumesClonetasksGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.v2.volumes.clonetasks.get", Method: "GET", PathPattern: "/pcloud/v2/cloud-instances/{cloud_instance_id}/volumes/clone-tasks/{clone_task_id}", @@ -451,24 +647,34 @@ func (a *Client) PcloudV2VolumesClonetasksGet(params *PcloudV2VolumesClonetasksG AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudV2VolumesClonetasksGetOK), nil - + success, ok := result.(*PcloudV2VolumesClonetasksGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.v2.volumes.clonetasks.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudV2VolumesPost creates multiple data volumes from a single definition + PcloudV2VolumesPost creates multiple data volumes from a single definition */ -func (a *Client) PcloudV2VolumesPost(params *PcloudV2VolumesPostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudV2VolumesPostCreated, error) { +func (a *Client) PcloudV2VolumesPost(params *PcloudV2VolumesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumesPostCreated, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudV2VolumesPostParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.v2.volumes.post", Method: "POST", PathPattern: "/pcloud/v2/cloud-instances/{cloud_instance_id}/volumes", @@ -480,24 +686,34 @@ func (a *Client) PcloudV2VolumesPost(params *PcloudV2VolumesPostParams, authInfo AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudV2VolumesPostCreated), nil - + success, ok := result.(*PcloudV2VolumesPostCreated) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.v2.volumes.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudV2VolumescloneCancelPost cancels a volumes clone request initiates the cleanup action cleanup action performs the cleanup of the preparatory clones and snapshot volumes + PcloudV2VolumescloneCancelPost cancels a volumes clone request initiates the cleanup action cleanup action performs the cleanup of the preparatory clones and snapshot volumes */ -func (a *Client) PcloudV2VolumescloneCancelPost(params *PcloudV2VolumescloneCancelPostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudV2VolumescloneCancelPostAccepted, error) { +func (a *Client) PcloudV2VolumescloneCancelPost(params *PcloudV2VolumescloneCancelPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumescloneCancelPostAccepted, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudV2VolumescloneCancelPostParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.v2.volumesclone.cancel.post", Method: "POST", PathPattern: "/pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}/cancel", @@ -509,24 +725,34 @@ func (a *Client) PcloudV2VolumescloneCancelPost(params *PcloudV2VolumescloneCanc AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudV2VolumescloneCancelPostAccepted), nil - + success, ok := result.(*PcloudV2VolumescloneCancelPostAccepted) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.v2.volumesclone.cancel.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudV2VolumescloneDelete deletes a volumes clone request + PcloudV2VolumescloneDelete deletes a volumes clone request */ -func (a *Client) PcloudV2VolumescloneDelete(params *PcloudV2VolumescloneDeleteParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudV2VolumescloneDeleteOK, error) { +func (a *Client) PcloudV2VolumescloneDelete(params *PcloudV2VolumescloneDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumescloneDeleteOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudV2VolumescloneDeleteParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.v2.volumesclone.delete", Method: "DELETE", PathPattern: "/pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}", @@ -538,24 +764,34 @@ func (a *Client) PcloudV2VolumescloneDelete(params *PcloudV2VolumescloneDeletePa AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudV2VolumescloneDeleteOK), nil - + success, ok := result.(*PcloudV2VolumescloneDeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.v2.volumesclone.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudV2VolumescloneExecutePost initiates the execute action for a volumes clone request execute action creates the cloned volumes using the volume snapshots + PcloudV2VolumescloneExecutePost initiates the execute action for a volumes clone request execute action creates the cloned volumes using the volume snapshots */ -func (a *Client) PcloudV2VolumescloneExecutePost(params *PcloudV2VolumescloneExecutePostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudV2VolumescloneExecutePostAccepted, error) { +func (a *Client) PcloudV2VolumescloneExecutePost(params *PcloudV2VolumescloneExecutePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumescloneExecutePostAccepted, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudV2VolumescloneExecutePostParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.v2.volumesclone.execute.post", Method: "POST", PathPattern: "/pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}/execute", @@ -567,24 +803,34 @@ func (a *Client) PcloudV2VolumescloneExecutePost(params *PcloudV2VolumescloneExe AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudV2VolumescloneExecutePostAccepted), nil - + success, ok := result.(*PcloudV2VolumescloneExecutePostAccepted) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.v2.volumesclone.execute.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudV2VolumescloneGet gets the details for a volumes clone request + PcloudV2VolumescloneGet gets the details for a volumes clone request */ -func (a *Client) PcloudV2VolumescloneGet(params *PcloudV2VolumescloneGetParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudV2VolumescloneGetOK, error) { +func (a *Client) PcloudV2VolumescloneGet(params *PcloudV2VolumescloneGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumescloneGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudV2VolumescloneGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.v2.volumesclone.get", Method: "GET", PathPattern: "/pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}", @@ -596,24 +842,34 @@ func (a *Client) PcloudV2VolumescloneGet(params *PcloudV2VolumescloneGetParams, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudV2VolumescloneGetOK), nil - + success, ok := result.(*PcloudV2VolumescloneGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.v2.volumesclone.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudV2VolumescloneGetall gets the list of volumes clone request for a cloud instance + PcloudV2VolumescloneGetall gets the list of volumes clone request for a cloud instance */ -func (a *Client) PcloudV2VolumescloneGetall(params *PcloudV2VolumescloneGetallParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudV2VolumescloneGetallOK, error) { +func (a *Client) PcloudV2VolumescloneGetall(params *PcloudV2VolumescloneGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumescloneGetallOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudV2VolumescloneGetallParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.v2.volumesclone.getall", Method: "GET", PathPattern: "/pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone", @@ -625,24 +881,34 @@ func (a *Client) PcloudV2VolumescloneGetall(params *PcloudV2VolumescloneGetallPa AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudV2VolumescloneGetallOK), nil - + success, ok := result.(*PcloudV2VolumescloneGetallOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.v2.volumesclone.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudV2VolumesclonePost creates a new volumes clone request and initiates the prepare action requires a minimum of two volumes requires a minimum of one volume to be in the in use state requires a unique volumes clone name prepare action does the preparatory work for creating the snapshot volumes + PcloudV2VolumesclonePost creates a new volumes clone request and initiates the prepare action requires a minimum of two volumes requires a minimum of one volume to be in the in use state requires a unique volumes clone name prepare action does the preparatory work for creating the snapshot volumes */ -func (a *Client) PcloudV2VolumesclonePost(params *PcloudV2VolumesclonePostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudV2VolumesclonePostAccepted, error) { +func (a *Client) PcloudV2VolumesclonePost(params *PcloudV2VolumesclonePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumesclonePostAccepted, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudV2VolumesclonePostParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.v2.volumesclone.post", Method: "POST", PathPattern: "/pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone", @@ -654,24 +920,34 @@ func (a *Client) PcloudV2VolumesclonePost(params *PcloudV2VolumesclonePostParams AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudV2VolumesclonePostAccepted), nil - + success, ok := result.(*PcloudV2VolumesclonePostAccepted) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.v2.volumesclone.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudV2VolumescloneStartPost initiates the start action for a volumes clone request start action starts the consistency group to initiate the flash copy + PcloudV2VolumescloneStartPost initiates the start action for a volumes clone request start action starts the consistency group to initiate the flash copy */ -func (a *Client) PcloudV2VolumescloneStartPost(params *PcloudV2VolumescloneStartPostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudV2VolumescloneStartPostOK, error) { +func (a *Client) PcloudV2VolumescloneStartPost(params *PcloudV2VolumescloneStartPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumescloneStartPostOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudV2VolumescloneStartPostParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.v2.volumesclone.start.post", Method: "POST", PathPattern: "/pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}/start", @@ -683,24 +959,34 @@ func (a *Client) PcloudV2VolumescloneStartPost(params *PcloudV2VolumescloneStart AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudV2VolumescloneStartPostOK), nil - + success, ok := result.(*PcloudV2VolumescloneStartPostOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.v2.volumesclone.start.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PcloudVolumesClonePost creates a volume clone for specified volumes + PcloudVolumesClonePost creates a volume clone for specified volumes */ -func (a *Client) PcloudVolumesClonePost(params *PcloudVolumesClonePostParams, authInfo runtime.ClientAuthInfoWriter) (*PcloudVolumesClonePostOK, error) { +func (a *Client) PcloudVolumesClonePost(params *PcloudVolumesClonePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVolumesClonePostOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPcloudVolumesClonePostParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "pcloud.volumes.clone.post", Method: "POST", PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/clone", @@ -712,12 +998,23 @@ func (a *Client) PcloudVolumesClonePost(params *PcloudVolumesClonePostParams, au AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PcloudVolumesClonePostOK), nil - + success, ok := result.(*PcloudVolumesClonePostOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pcloud.volumes.clone.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } // SetTransport changes the transport on the client diff --git a/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_action_post_parameters.go b/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_action_post_parameters.go index cccce0b7..a66e7a29 100644 --- a/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_action_post_parameters.go +++ b/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_action_post_parameters.go @@ -13,69 +13,69 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudCloudinstancesVolumesActionPostParams creates a new PcloudCloudinstancesVolumesActionPostParams object -// with the default values initialized. +// NewPcloudCloudinstancesVolumesActionPostParams creates a new PcloudCloudinstancesVolumesActionPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudCloudinstancesVolumesActionPostParams() *PcloudCloudinstancesVolumesActionPostParams { - var () return &PcloudCloudinstancesVolumesActionPostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudCloudinstancesVolumesActionPostParamsWithTimeout creates a new PcloudCloudinstancesVolumesActionPostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudCloudinstancesVolumesActionPostParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesVolumesActionPostParams { - var () return &PcloudCloudinstancesVolumesActionPostParams{ - timeout: timeout, } } // NewPcloudCloudinstancesVolumesActionPostParamsWithContext creates a new PcloudCloudinstancesVolumesActionPostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudCloudinstancesVolumesActionPostParamsWithContext(ctx context.Context) *PcloudCloudinstancesVolumesActionPostParams { - var () return &PcloudCloudinstancesVolumesActionPostParams{ - Context: ctx, } } // NewPcloudCloudinstancesVolumesActionPostParamsWithHTTPClient creates a new PcloudCloudinstancesVolumesActionPostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudCloudinstancesVolumesActionPostParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesVolumesActionPostParams { - var () return &PcloudCloudinstancesVolumesActionPostParams{ HTTPClient: client, } } -/*PcloudCloudinstancesVolumesActionPostParams contains all the parameters to send to the API endpoint -for the pcloud cloudinstances volumes action post operation typically these are written to a http.Request +/* PcloudCloudinstancesVolumesActionPostParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances volumes action post operation. + + Typically these are written to a http.Request. */ type PcloudCloudinstancesVolumesActionPostParams struct { - /*Body - Parameters for the desired action + /* Body. + Parameters for the desired action */ Body *models.VolumeAction - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*VolumeID - Volume ID + /* VolumeID. + + Volume ID */ VolumeID string @@ -84,6 +84,21 @@ type PcloudCloudinstancesVolumesActionPostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud cloudinstances volumes action post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesVolumesActionPostParams) WithDefaults() *PcloudCloudinstancesVolumesActionPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances volumes action post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesVolumesActionPostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud cloudinstances volumes action post params func (o *PcloudCloudinstancesVolumesActionPostParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesVolumesActionPostParams { o.SetTimeout(timeout) @@ -157,7 +172,6 @@ func (o *PcloudCloudinstancesVolumesActionPostParams) WriteToRequest(r runtime.C return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_action_post_responses.go b/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_action_post_responses.go index 032708ca..24d75e2c 100644 --- a/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_action_post_responses.go +++ b/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_action_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudCloudinstancesVolumesActionPostReader is a Reader for the PcloudCloudinstancesVolumesActionPost structure. @@ -24,44 +23,38 @@ type PcloudCloudinstancesVolumesActionPostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudCloudinstancesVolumesActionPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 202: result := NewPcloudCloudinstancesVolumesActionPostAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudCloudinstancesVolumesActionPostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudCloudinstancesVolumesActionPostUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudCloudinstancesVolumesActionPostNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudCloudinstancesVolumesActionPostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudCloudinstancesVolumesActionPostAccepted() *PcloudCloudinstancesVol return &PcloudCloudinstancesVolumesActionPostAccepted{} } -/*PcloudCloudinstancesVolumesActionPostAccepted handles this case with default header values. +/* PcloudCloudinstancesVolumesActionPostAccepted describes a response with status code 202, with default header values. Accepted */ @@ -81,6 +74,9 @@ type PcloudCloudinstancesVolumesActionPostAccepted struct { func (o *PcloudCloudinstancesVolumesActionPostAccepted) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}/action][%d] pcloudCloudinstancesVolumesActionPostAccepted %+v", 202, o.Payload) } +func (o *PcloudCloudinstancesVolumesActionPostAccepted) GetPayload() models.Object { + return o.Payload +} func (o *PcloudCloudinstancesVolumesActionPostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -97,7 +93,7 @@ func NewPcloudCloudinstancesVolumesActionPostBadRequest() *PcloudCloudinstancesV return &PcloudCloudinstancesVolumesActionPostBadRequest{} } -/*PcloudCloudinstancesVolumesActionPostBadRequest handles this case with default header values. +/* PcloudCloudinstancesVolumesActionPostBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -108,6 +104,9 @@ type PcloudCloudinstancesVolumesActionPostBadRequest struct { func (o *PcloudCloudinstancesVolumesActionPostBadRequest) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}/action][%d] pcloudCloudinstancesVolumesActionPostBadRequest %+v", 400, o.Payload) } +func (o *PcloudCloudinstancesVolumesActionPostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesVolumesActionPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -126,7 +125,7 @@ func NewPcloudCloudinstancesVolumesActionPostUnauthorized() *PcloudCloudinstance return &PcloudCloudinstancesVolumesActionPostUnauthorized{} } -/*PcloudCloudinstancesVolumesActionPostUnauthorized handles this case with default header values. +/* PcloudCloudinstancesVolumesActionPostUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -137,6 +136,9 @@ type PcloudCloudinstancesVolumesActionPostUnauthorized struct { func (o *PcloudCloudinstancesVolumesActionPostUnauthorized) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}/action][%d] pcloudCloudinstancesVolumesActionPostUnauthorized %+v", 401, o.Payload) } +func (o *PcloudCloudinstancesVolumesActionPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesVolumesActionPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -155,7 +157,7 @@ func NewPcloudCloudinstancesVolumesActionPostNotFound() *PcloudCloudinstancesVol return &PcloudCloudinstancesVolumesActionPostNotFound{} } -/*PcloudCloudinstancesVolumesActionPostNotFound handles this case with default header values. +/* PcloudCloudinstancesVolumesActionPostNotFound describes a response with status code 404, with default header values. Not Found */ @@ -166,6 +168,9 @@ type PcloudCloudinstancesVolumesActionPostNotFound struct { func (o *PcloudCloudinstancesVolumesActionPostNotFound) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}/action][%d] pcloudCloudinstancesVolumesActionPostNotFound %+v", 404, o.Payload) } +func (o *PcloudCloudinstancesVolumesActionPostNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesVolumesActionPostNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -184,7 +189,7 @@ func NewPcloudCloudinstancesVolumesActionPostInternalServerError() *PcloudCloudi return &PcloudCloudinstancesVolumesActionPostInternalServerError{} } -/*PcloudCloudinstancesVolumesActionPostInternalServerError handles this case with default header values. +/* PcloudCloudinstancesVolumesActionPostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -195,6 +200,9 @@ type PcloudCloudinstancesVolumesActionPostInternalServerError struct { func (o *PcloudCloudinstancesVolumesActionPostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}/action][%d] pcloudCloudinstancesVolumesActionPostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudCloudinstancesVolumesActionPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesVolumesActionPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_delete_parameters.go b/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_delete_parameters.go index 9eda652b..d6066439 100644 --- a/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_delete_parameters.go +++ b/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_delete_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudCloudinstancesVolumesDeleteParams creates a new PcloudCloudinstancesVolumesDeleteParams object -// with the default values initialized. +// NewPcloudCloudinstancesVolumesDeleteParams creates a new PcloudCloudinstancesVolumesDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudCloudinstancesVolumesDeleteParams() *PcloudCloudinstancesVolumesDeleteParams { - var () return &PcloudCloudinstancesVolumesDeleteParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudCloudinstancesVolumesDeleteParamsWithTimeout creates a new PcloudCloudinstancesVolumesDeleteParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudCloudinstancesVolumesDeleteParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesVolumesDeleteParams { - var () return &PcloudCloudinstancesVolumesDeleteParams{ - timeout: timeout, } } // NewPcloudCloudinstancesVolumesDeleteParamsWithContext creates a new PcloudCloudinstancesVolumesDeleteParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudCloudinstancesVolumesDeleteParamsWithContext(ctx context.Context) *PcloudCloudinstancesVolumesDeleteParams { - var () return &PcloudCloudinstancesVolumesDeleteParams{ - Context: ctx, } } // NewPcloudCloudinstancesVolumesDeleteParamsWithHTTPClient creates a new PcloudCloudinstancesVolumesDeleteParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudCloudinstancesVolumesDeleteParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesVolumesDeleteParams { - var () return &PcloudCloudinstancesVolumesDeleteParams{ HTTPClient: client, } } -/*PcloudCloudinstancesVolumesDeleteParams contains all the parameters to send to the API endpoint -for the pcloud cloudinstances volumes delete operation typically these are written to a http.Request +/* PcloudCloudinstancesVolumesDeleteParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances volumes delete operation. + + Typically these are written to a http.Request. */ type PcloudCloudinstancesVolumesDeleteParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*VolumeID - Volume ID + /* VolumeID. + + Volume ID */ VolumeID string @@ -77,6 +76,21 @@ type PcloudCloudinstancesVolumesDeleteParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud cloudinstances volumes delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesVolumesDeleteParams) WithDefaults() *PcloudCloudinstancesVolumesDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances volumes delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesVolumesDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud cloudinstances volumes delete params func (o *PcloudCloudinstancesVolumesDeleteParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesVolumesDeleteParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_delete_responses.go b/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_delete_responses.go index 25269897..eb7f8fbf 100644 --- a/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_delete_responses.go +++ b/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_delete_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudCloudinstancesVolumesDeleteReader is a Reader for the PcloudCloudinstancesVolumesDelete structure. @@ -24,44 +23,38 @@ type PcloudCloudinstancesVolumesDeleteReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudCloudinstancesVolumesDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudCloudinstancesVolumesDeleteOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudCloudinstancesVolumesDeleteBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudCloudinstancesVolumesDeleteUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 410: result := NewPcloudCloudinstancesVolumesDeleteGone() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudCloudinstancesVolumesDeleteInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudCloudinstancesVolumesDeleteOK() *PcloudCloudinstancesVolumesDelete return &PcloudCloudinstancesVolumesDeleteOK{} } -/*PcloudCloudinstancesVolumesDeleteOK handles this case with default header values. +/* PcloudCloudinstancesVolumesDeleteOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudCloudinstancesVolumesDeleteOK struct { func (o *PcloudCloudinstancesVolumesDeleteOK) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}][%d] pcloudCloudinstancesVolumesDeleteOK %+v", 200, o.Payload) } +func (o *PcloudCloudinstancesVolumesDeleteOK) GetPayload() models.Object { + return o.Payload +} func (o *PcloudCloudinstancesVolumesDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -97,7 +93,7 @@ func NewPcloudCloudinstancesVolumesDeleteBadRequest() *PcloudCloudinstancesVolum return &PcloudCloudinstancesVolumesDeleteBadRequest{} } -/*PcloudCloudinstancesVolumesDeleteBadRequest handles this case with default header values. +/* PcloudCloudinstancesVolumesDeleteBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -108,6 +104,9 @@ type PcloudCloudinstancesVolumesDeleteBadRequest struct { func (o *PcloudCloudinstancesVolumesDeleteBadRequest) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}][%d] pcloudCloudinstancesVolumesDeleteBadRequest %+v", 400, o.Payload) } +func (o *PcloudCloudinstancesVolumesDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesVolumesDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -126,7 +125,7 @@ func NewPcloudCloudinstancesVolumesDeleteUnauthorized() *PcloudCloudinstancesVol return &PcloudCloudinstancesVolumesDeleteUnauthorized{} } -/*PcloudCloudinstancesVolumesDeleteUnauthorized handles this case with default header values. +/* PcloudCloudinstancesVolumesDeleteUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -137,6 +136,9 @@ type PcloudCloudinstancesVolumesDeleteUnauthorized struct { func (o *PcloudCloudinstancesVolumesDeleteUnauthorized) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}][%d] pcloudCloudinstancesVolumesDeleteUnauthorized %+v", 401, o.Payload) } +func (o *PcloudCloudinstancesVolumesDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesVolumesDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -155,7 +157,7 @@ func NewPcloudCloudinstancesVolumesDeleteGone() *PcloudCloudinstancesVolumesDele return &PcloudCloudinstancesVolumesDeleteGone{} } -/*PcloudCloudinstancesVolumesDeleteGone handles this case with default header values. +/* PcloudCloudinstancesVolumesDeleteGone describes a response with status code 410, with default header values. Gone */ @@ -166,6 +168,9 @@ type PcloudCloudinstancesVolumesDeleteGone struct { func (o *PcloudCloudinstancesVolumesDeleteGone) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}][%d] pcloudCloudinstancesVolumesDeleteGone %+v", 410, o.Payload) } +func (o *PcloudCloudinstancesVolumesDeleteGone) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesVolumesDeleteGone) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -184,7 +189,7 @@ func NewPcloudCloudinstancesVolumesDeleteInternalServerError() *PcloudCloudinsta return &PcloudCloudinstancesVolumesDeleteInternalServerError{} } -/*PcloudCloudinstancesVolumesDeleteInternalServerError handles this case with default header values. +/* PcloudCloudinstancesVolumesDeleteInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -195,6 +200,9 @@ type PcloudCloudinstancesVolumesDeleteInternalServerError struct { func (o *PcloudCloudinstancesVolumesDeleteInternalServerError) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}][%d] pcloudCloudinstancesVolumesDeleteInternalServerError %+v", 500, o.Payload) } +func (o *PcloudCloudinstancesVolumesDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesVolumesDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_get_parameters.go b/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_get_parameters.go index a922bbac..df8f8e69 100644 --- a/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_get_parameters.go +++ b/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_get_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudCloudinstancesVolumesGetParams creates a new PcloudCloudinstancesVolumesGetParams object -// with the default values initialized. +// NewPcloudCloudinstancesVolumesGetParams creates a new PcloudCloudinstancesVolumesGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudCloudinstancesVolumesGetParams() *PcloudCloudinstancesVolumesGetParams { - var () return &PcloudCloudinstancesVolumesGetParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudCloudinstancesVolumesGetParamsWithTimeout creates a new PcloudCloudinstancesVolumesGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudCloudinstancesVolumesGetParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesVolumesGetParams { - var () return &PcloudCloudinstancesVolumesGetParams{ - timeout: timeout, } } // NewPcloudCloudinstancesVolumesGetParamsWithContext creates a new PcloudCloudinstancesVolumesGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudCloudinstancesVolumesGetParamsWithContext(ctx context.Context) *PcloudCloudinstancesVolumesGetParams { - var () return &PcloudCloudinstancesVolumesGetParams{ - Context: ctx, } } // NewPcloudCloudinstancesVolumesGetParamsWithHTTPClient creates a new PcloudCloudinstancesVolumesGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudCloudinstancesVolumesGetParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesVolumesGetParams { - var () return &PcloudCloudinstancesVolumesGetParams{ HTTPClient: client, } } -/*PcloudCloudinstancesVolumesGetParams contains all the parameters to send to the API endpoint -for the pcloud cloudinstances volumes get operation typically these are written to a http.Request +/* PcloudCloudinstancesVolumesGetParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances volumes get operation. + + Typically these are written to a http.Request. */ type PcloudCloudinstancesVolumesGetParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*VolumeID - Volume ID + /* VolumeID. + + Volume ID */ VolumeID string @@ -77,6 +76,21 @@ type PcloudCloudinstancesVolumesGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud cloudinstances volumes get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesVolumesGetParams) WithDefaults() *PcloudCloudinstancesVolumesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances volumes get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesVolumesGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud cloudinstances volumes get params func (o *PcloudCloudinstancesVolumesGetParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesVolumesGetParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_get_responses.go b/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_get_responses.go index 9f536aeb..896d21be 100644 --- a/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_get_responses.go +++ b/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudCloudinstancesVolumesGetReader is a Reader for the PcloudCloudinstancesVolumesGet structure. @@ -24,44 +23,38 @@ type PcloudCloudinstancesVolumesGetReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudCloudinstancesVolumesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudCloudinstancesVolumesGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudCloudinstancesVolumesGetBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudCloudinstancesVolumesGetUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudCloudinstancesVolumesGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudCloudinstancesVolumesGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudCloudinstancesVolumesGetOK() *PcloudCloudinstancesVolumesGetOK { return &PcloudCloudinstancesVolumesGetOK{} } -/*PcloudCloudinstancesVolumesGetOK handles this case with default header values. +/* PcloudCloudinstancesVolumesGetOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudCloudinstancesVolumesGetOK struct { func (o *PcloudCloudinstancesVolumesGetOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}][%d] pcloudCloudinstancesVolumesGetOK %+v", 200, o.Payload) } +func (o *PcloudCloudinstancesVolumesGetOK) GetPayload() *models.Volume { + return o.Payload +} func (o *PcloudCloudinstancesVolumesGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudCloudinstancesVolumesGetBadRequest() *PcloudCloudinstancesVolumesG return &PcloudCloudinstancesVolumesGetBadRequest{} } -/*PcloudCloudinstancesVolumesGetBadRequest handles this case with default header values. +/* PcloudCloudinstancesVolumesGetBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudCloudinstancesVolumesGetBadRequest struct { func (o *PcloudCloudinstancesVolumesGetBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}][%d] pcloudCloudinstancesVolumesGetBadRequest %+v", 400, o.Payload) } +func (o *PcloudCloudinstancesVolumesGetBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesVolumesGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudCloudinstancesVolumesGetUnauthorized() *PcloudCloudinstancesVolume return &PcloudCloudinstancesVolumesGetUnauthorized{} } -/*PcloudCloudinstancesVolumesGetUnauthorized handles this case with default header values. +/* PcloudCloudinstancesVolumesGetUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudCloudinstancesVolumesGetUnauthorized struct { func (o *PcloudCloudinstancesVolumesGetUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}][%d] pcloudCloudinstancesVolumesGetUnauthorized %+v", 401, o.Payload) } +func (o *PcloudCloudinstancesVolumesGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesVolumesGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudCloudinstancesVolumesGetNotFound() *PcloudCloudinstancesVolumesGet return &PcloudCloudinstancesVolumesGetNotFound{} } -/*PcloudCloudinstancesVolumesGetNotFound handles this case with default header values. +/* PcloudCloudinstancesVolumesGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -168,6 +170,9 @@ type PcloudCloudinstancesVolumesGetNotFound struct { func (o *PcloudCloudinstancesVolumesGetNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}][%d] pcloudCloudinstancesVolumesGetNotFound %+v", 404, o.Payload) } +func (o *PcloudCloudinstancesVolumesGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesVolumesGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudCloudinstancesVolumesGetInternalServerError() *PcloudCloudinstance return &PcloudCloudinstancesVolumesGetInternalServerError{} } -/*PcloudCloudinstancesVolumesGetInternalServerError handles this case with default header values. +/* PcloudCloudinstancesVolumesGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudCloudinstancesVolumesGetInternalServerError struct { func (o *PcloudCloudinstancesVolumesGetInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}][%d] pcloudCloudinstancesVolumesGetInternalServerError %+v", 500, o.Payload) } +func (o *PcloudCloudinstancesVolumesGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesVolumesGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_getall_parameters.go b/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_getall_parameters.go index eadb9674..55d12eff 100644 --- a/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_getall_parameters.go +++ b/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_getall_parameters.go @@ -13,70 +13,91 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) -// NewPcloudCloudinstancesVolumesGetallParams creates a new PcloudCloudinstancesVolumesGetallParams object -// with the default values initialized. +// NewPcloudCloudinstancesVolumesGetallParams creates a new PcloudCloudinstancesVolumesGetallParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudCloudinstancesVolumesGetallParams() *PcloudCloudinstancesVolumesGetallParams { - var () return &PcloudCloudinstancesVolumesGetallParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudCloudinstancesVolumesGetallParamsWithTimeout creates a new PcloudCloudinstancesVolumesGetallParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudCloudinstancesVolumesGetallParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesVolumesGetallParams { - var () return &PcloudCloudinstancesVolumesGetallParams{ - timeout: timeout, } } // NewPcloudCloudinstancesVolumesGetallParamsWithContext creates a new PcloudCloudinstancesVolumesGetallParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudCloudinstancesVolumesGetallParamsWithContext(ctx context.Context) *PcloudCloudinstancesVolumesGetallParams { - var () return &PcloudCloudinstancesVolumesGetallParams{ - Context: ctx, } } // NewPcloudCloudinstancesVolumesGetallParamsWithHTTPClient creates a new PcloudCloudinstancesVolumesGetallParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudCloudinstancesVolumesGetallParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesVolumesGetallParams { - var () return &PcloudCloudinstancesVolumesGetallParams{ HTTPClient: client, } } -/*PcloudCloudinstancesVolumesGetallParams contains all the parameters to send to the API endpoint -for the pcloud cloudinstances volumes getall operation typically these are written to a http.Request +/* PcloudCloudinstancesVolumesGetallParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances volumes getall operation. + + Typically these are written to a http.Request. */ type PcloudCloudinstancesVolumesGetallParams struct { - /*Affinity - A pvmInstance (id or name), limits a volumes list response to only volumes that have affinity to the pvmInstance + /* Affinity. + A pvmInstance (id or name), limits a volumes list response to only volumes that have affinity to the pvmInstance */ Affinity *string - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string + /* ReplicationEnabled. + + true or false, limits a volumes list to replication or non replication enabled volumes + */ + ReplicationEnabled *bool + timeout time.Duration Context context.Context HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud cloudinstances volumes getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesVolumesGetallParams) WithDefaults() *PcloudCloudinstancesVolumesGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances volumes getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesVolumesGetallParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud cloudinstances volumes getall params func (o *PcloudCloudinstancesVolumesGetallParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesVolumesGetallParams { o.SetTimeout(timeout) @@ -132,6 +153,17 @@ func (o *PcloudCloudinstancesVolumesGetallParams) SetCloudInstanceID(cloudInstan o.CloudInstanceID = cloudInstanceID } +// WithReplicationEnabled adds the replicationEnabled to the pcloud cloudinstances volumes getall params +func (o *PcloudCloudinstancesVolumesGetallParams) WithReplicationEnabled(replicationEnabled *bool) *PcloudCloudinstancesVolumesGetallParams { + o.SetReplicationEnabled(replicationEnabled) + return o +} + +// SetReplicationEnabled adds the replicationEnabled to the pcloud cloudinstances volumes getall params +func (o *PcloudCloudinstancesVolumesGetallParams) SetReplicationEnabled(replicationEnabled *bool) { + o.ReplicationEnabled = replicationEnabled +} + // WriteToRequest writes these params to a swagger request func (o *PcloudCloudinstancesVolumesGetallParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { @@ -144,16 +176,17 @@ func (o *PcloudCloudinstancesVolumesGetallParams) WriteToRequest(r runtime.Clien // query param affinity var qrAffinity string + if o.Affinity != nil { qrAffinity = *o.Affinity } qAffinity := qrAffinity if qAffinity != "" { + if err := r.SetQueryParam("affinity", qAffinity); err != nil { return err } } - } // path param cloud_instance_id @@ -161,6 +194,23 @@ func (o *PcloudCloudinstancesVolumesGetallParams) WriteToRequest(r runtime.Clien return err } + if o.ReplicationEnabled != nil { + + // query param replicationEnabled + var qrReplicationEnabled bool + + if o.ReplicationEnabled != nil { + qrReplicationEnabled = *o.ReplicationEnabled + } + qReplicationEnabled := swag.FormatBool(qrReplicationEnabled) + if qReplicationEnabled != "" { + + if err := r.SetQueryParam("replicationEnabled", qReplicationEnabled); err != nil { + return err + } + } + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } diff --git a/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_getall_responses.go b/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_getall_responses.go index 388793f9..88e6badb 100644 --- a/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_getall_responses.go +++ b/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_getall_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudCloudinstancesVolumesGetallReader is a Reader for the PcloudCloudinstancesVolumesGetall structure. @@ -24,44 +23,38 @@ type PcloudCloudinstancesVolumesGetallReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudCloudinstancesVolumesGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudCloudinstancesVolumesGetallOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudCloudinstancesVolumesGetallBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudCloudinstancesVolumesGetallUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudCloudinstancesVolumesGetallNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudCloudinstancesVolumesGetallInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudCloudinstancesVolumesGetallOK() *PcloudCloudinstancesVolumesGetall return &PcloudCloudinstancesVolumesGetallOK{} } -/*PcloudCloudinstancesVolumesGetallOK handles this case with default header values. +/* PcloudCloudinstancesVolumesGetallOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudCloudinstancesVolumesGetallOK struct { func (o *PcloudCloudinstancesVolumesGetallOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudCloudinstancesVolumesGetallOK %+v", 200, o.Payload) } +func (o *PcloudCloudinstancesVolumesGetallOK) GetPayload() *models.Volumes { + return o.Payload +} func (o *PcloudCloudinstancesVolumesGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudCloudinstancesVolumesGetallBadRequest() *PcloudCloudinstancesVolum return &PcloudCloudinstancesVolumesGetallBadRequest{} } -/*PcloudCloudinstancesVolumesGetallBadRequest handles this case with default header values. +/* PcloudCloudinstancesVolumesGetallBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudCloudinstancesVolumesGetallBadRequest struct { func (o *PcloudCloudinstancesVolumesGetallBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudCloudinstancesVolumesGetallBadRequest %+v", 400, o.Payload) } +func (o *PcloudCloudinstancesVolumesGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesVolumesGetallBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudCloudinstancesVolumesGetallUnauthorized() *PcloudCloudinstancesVol return &PcloudCloudinstancesVolumesGetallUnauthorized{} } -/*PcloudCloudinstancesVolumesGetallUnauthorized handles this case with default header values. +/* PcloudCloudinstancesVolumesGetallUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudCloudinstancesVolumesGetallUnauthorized struct { func (o *PcloudCloudinstancesVolumesGetallUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudCloudinstancesVolumesGetallUnauthorized %+v", 401, o.Payload) } +func (o *PcloudCloudinstancesVolumesGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesVolumesGetallUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudCloudinstancesVolumesGetallNotFound() *PcloudCloudinstancesVolumes return &PcloudCloudinstancesVolumesGetallNotFound{} } -/*PcloudCloudinstancesVolumesGetallNotFound handles this case with default header values. +/* PcloudCloudinstancesVolumesGetallNotFound describes a response with status code 404, with default header values. Not Found */ @@ -168,6 +170,9 @@ type PcloudCloudinstancesVolumesGetallNotFound struct { func (o *PcloudCloudinstancesVolumesGetallNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudCloudinstancesVolumesGetallNotFound %+v", 404, o.Payload) } +func (o *PcloudCloudinstancesVolumesGetallNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesVolumesGetallNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudCloudinstancesVolumesGetallInternalServerError() *PcloudCloudinsta return &PcloudCloudinstancesVolumesGetallInternalServerError{} } -/*PcloudCloudinstancesVolumesGetallInternalServerError handles this case with default header values. +/* PcloudCloudinstancesVolumesGetallInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudCloudinstancesVolumesGetallInternalServerError struct { func (o *PcloudCloudinstancesVolumesGetallInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudCloudinstancesVolumesGetallInternalServerError %+v", 500, o.Payload) } +func (o *PcloudCloudinstancesVolumesGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesVolumesGetallInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_post_parameters.go b/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_post_parameters.go index 55a0685e..456bf17a 100644 --- a/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_post_parameters.go +++ b/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_post_parameters.go @@ -13,64 +13,63 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudCloudinstancesVolumesPostParams creates a new PcloudCloudinstancesVolumesPostParams object -// with the default values initialized. +// NewPcloudCloudinstancesVolumesPostParams creates a new PcloudCloudinstancesVolumesPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudCloudinstancesVolumesPostParams() *PcloudCloudinstancesVolumesPostParams { - var () return &PcloudCloudinstancesVolumesPostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudCloudinstancesVolumesPostParamsWithTimeout creates a new PcloudCloudinstancesVolumesPostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudCloudinstancesVolumesPostParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesVolumesPostParams { - var () return &PcloudCloudinstancesVolumesPostParams{ - timeout: timeout, } } // NewPcloudCloudinstancesVolumesPostParamsWithContext creates a new PcloudCloudinstancesVolumesPostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudCloudinstancesVolumesPostParamsWithContext(ctx context.Context) *PcloudCloudinstancesVolumesPostParams { - var () return &PcloudCloudinstancesVolumesPostParams{ - Context: ctx, } } // NewPcloudCloudinstancesVolumesPostParamsWithHTTPClient creates a new PcloudCloudinstancesVolumesPostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudCloudinstancesVolumesPostParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesVolumesPostParams { - var () return &PcloudCloudinstancesVolumesPostParams{ HTTPClient: client, } } -/*PcloudCloudinstancesVolumesPostParams contains all the parameters to send to the API endpoint -for the pcloud cloudinstances volumes post operation typically these are written to a http.Request +/* PcloudCloudinstancesVolumesPostParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances volumes post operation. + + Typically these are written to a http.Request. */ type PcloudCloudinstancesVolumesPostParams struct { - /*Body - Parameters for the creation of a new data volume + /* Body. + Parameters for the creation of a new data volume */ Body *models.CreateDataVolume - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -79,6 +78,21 @@ type PcloudCloudinstancesVolumesPostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud cloudinstances volumes post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesVolumesPostParams) WithDefaults() *PcloudCloudinstancesVolumesPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances volumes post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesVolumesPostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud cloudinstances volumes post params func (o *PcloudCloudinstancesVolumesPostParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesVolumesPostParams { o.SetTimeout(timeout) @@ -141,7 +155,6 @@ func (o *PcloudCloudinstancesVolumesPostParams) WriteToRequest(r runtime.ClientR return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_post_responses.go b/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_post_responses.go index 649f58f5..258e913a 100644 --- a/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_post_responses.go +++ b/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudCloudinstancesVolumesPostReader is a Reader for the PcloudCloudinstancesVolumesPost structure. @@ -24,51 +23,44 @@ type PcloudCloudinstancesVolumesPostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudCloudinstancesVolumesPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 202: result := NewPcloudCloudinstancesVolumesPostAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudCloudinstancesVolumesPostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudCloudinstancesVolumesPostUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 409: result := NewPcloudCloudinstancesVolumesPostConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudCloudinstancesVolumesPostUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudCloudinstancesVolumesPostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -77,7 +69,7 @@ func NewPcloudCloudinstancesVolumesPostAccepted() *PcloudCloudinstancesVolumesPo return &PcloudCloudinstancesVolumesPostAccepted{} } -/*PcloudCloudinstancesVolumesPostAccepted handles this case with default header values. +/* PcloudCloudinstancesVolumesPostAccepted describes a response with status code 202, with default header values. Accepted */ @@ -88,6 +80,9 @@ type PcloudCloudinstancesVolumesPostAccepted struct { func (o *PcloudCloudinstancesVolumesPostAccepted) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudCloudinstancesVolumesPostAccepted %+v", 202, o.Payload) } +func (o *PcloudCloudinstancesVolumesPostAccepted) GetPayload() *models.Volume { + return o.Payload +} func (o *PcloudCloudinstancesVolumesPostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -106,7 +101,7 @@ func NewPcloudCloudinstancesVolumesPostBadRequest() *PcloudCloudinstancesVolumes return &PcloudCloudinstancesVolumesPostBadRequest{} } -/*PcloudCloudinstancesVolumesPostBadRequest handles this case with default header values. +/* PcloudCloudinstancesVolumesPostBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -117,6 +112,9 @@ type PcloudCloudinstancesVolumesPostBadRequest struct { func (o *PcloudCloudinstancesVolumesPostBadRequest) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudCloudinstancesVolumesPostBadRequest %+v", 400, o.Payload) } +func (o *PcloudCloudinstancesVolumesPostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesVolumesPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -135,7 +133,7 @@ func NewPcloudCloudinstancesVolumesPostUnauthorized() *PcloudCloudinstancesVolum return &PcloudCloudinstancesVolumesPostUnauthorized{} } -/*PcloudCloudinstancesVolumesPostUnauthorized handles this case with default header values. +/* PcloudCloudinstancesVolumesPostUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -146,6 +144,9 @@ type PcloudCloudinstancesVolumesPostUnauthorized struct { func (o *PcloudCloudinstancesVolumesPostUnauthorized) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudCloudinstancesVolumesPostUnauthorized %+v", 401, o.Payload) } +func (o *PcloudCloudinstancesVolumesPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesVolumesPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -164,7 +165,7 @@ func NewPcloudCloudinstancesVolumesPostConflict() *PcloudCloudinstancesVolumesPo return &PcloudCloudinstancesVolumesPostConflict{} } -/*PcloudCloudinstancesVolumesPostConflict handles this case with default header values. +/* PcloudCloudinstancesVolumesPostConflict describes a response with status code 409, with default header values. Conflict */ @@ -175,6 +176,9 @@ type PcloudCloudinstancesVolumesPostConflict struct { func (o *PcloudCloudinstancesVolumesPostConflict) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudCloudinstancesVolumesPostConflict %+v", 409, o.Payload) } +func (o *PcloudCloudinstancesVolumesPostConflict) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesVolumesPostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -193,7 +197,7 @@ func NewPcloudCloudinstancesVolumesPostUnprocessableEntity() *PcloudCloudinstanc return &PcloudCloudinstancesVolumesPostUnprocessableEntity{} } -/*PcloudCloudinstancesVolumesPostUnprocessableEntity handles this case with default header values. +/* PcloudCloudinstancesVolumesPostUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -204,6 +208,9 @@ type PcloudCloudinstancesVolumesPostUnprocessableEntity struct { func (o *PcloudCloudinstancesVolumesPostUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudCloudinstancesVolumesPostUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudCloudinstancesVolumesPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesVolumesPostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -222,7 +229,7 @@ func NewPcloudCloudinstancesVolumesPostInternalServerError() *PcloudCloudinstanc return &PcloudCloudinstancesVolumesPostInternalServerError{} } -/*PcloudCloudinstancesVolumesPostInternalServerError handles this case with default header values. +/* PcloudCloudinstancesVolumesPostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -233,6 +240,9 @@ type PcloudCloudinstancesVolumesPostInternalServerError struct { func (o *PcloudCloudinstancesVolumesPostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudCloudinstancesVolumesPostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudCloudinstancesVolumesPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesVolumesPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_put_parameters.go b/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_put_parameters.go index 05c98f1a..3c0e47c9 100644 --- a/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_put_parameters.go +++ b/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_put_parameters.go @@ -13,69 +13,69 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudCloudinstancesVolumesPutParams creates a new PcloudCloudinstancesVolumesPutParams object -// with the default values initialized. +// NewPcloudCloudinstancesVolumesPutParams creates a new PcloudCloudinstancesVolumesPutParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudCloudinstancesVolumesPutParams() *PcloudCloudinstancesVolumesPutParams { - var () return &PcloudCloudinstancesVolumesPutParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudCloudinstancesVolumesPutParamsWithTimeout creates a new PcloudCloudinstancesVolumesPutParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudCloudinstancesVolumesPutParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesVolumesPutParams { - var () return &PcloudCloudinstancesVolumesPutParams{ - timeout: timeout, } } // NewPcloudCloudinstancesVolumesPutParamsWithContext creates a new PcloudCloudinstancesVolumesPutParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudCloudinstancesVolumesPutParamsWithContext(ctx context.Context) *PcloudCloudinstancesVolumesPutParams { - var () return &PcloudCloudinstancesVolumesPutParams{ - Context: ctx, } } // NewPcloudCloudinstancesVolumesPutParamsWithHTTPClient creates a new PcloudCloudinstancesVolumesPutParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudCloudinstancesVolumesPutParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesVolumesPutParams { - var () return &PcloudCloudinstancesVolumesPutParams{ HTTPClient: client, } } -/*PcloudCloudinstancesVolumesPutParams contains all the parameters to send to the API endpoint -for the pcloud cloudinstances volumes put operation typically these are written to a http.Request +/* PcloudCloudinstancesVolumesPutParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances volumes put operation. + + Typically these are written to a http.Request. */ type PcloudCloudinstancesVolumesPutParams struct { - /*Body - Parameters to update a cloud instance volume + /* Body. + Parameters to update a cloud instance volume */ Body *models.UpdateVolume - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*VolumeID - Volume ID + /* VolumeID. + + Volume ID */ VolumeID string @@ -84,6 +84,21 @@ type PcloudCloudinstancesVolumesPutParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud cloudinstances volumes put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesVolumesPutParams) WithDefaults() *PcloudCloudinstancesVolumesPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances volumes put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesVolumesPutParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud cloudinstances volumes put params func (o *PcloudCloudinstancesVolumesPutParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesVolumesPutParams { o.SetTimeout(timeout) @@ -157,7 +172,6 @@ func (o *PcloudCloudinstancesVolumesPutParams) WriteToRequest(r runtime.ClientRe return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_put_responses.go b/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_put_responses.go index 988937c2..37837d85 100644 --- a/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_put_responses.go +++ b/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_put_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudCloudinstancesVolumesPutReader is a Reader for the PcloudCloudinstancesVolumesPut structure. @@ -24,51 +23,44 @@ type PcloudCloudinstancesVolumesPutReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudCloudinstancesVolumesPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudCloudinstancesVolumesPutOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudCloudinstancesVolumesPutBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudCloudinstancesVolumesPutUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 409: result := NewPcloudCloudinstancesVolumesPutConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudCloudinstancesVolumesPutUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudCloudinstancesVolumesPutInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -77,7 +69,7 @@ func NewPcloudCloudinstancesVolumesPutOK() *PcloudCloudinstancesVolumesPutOK { return &PcloudCloudinstancesVolumesPutOK{} } -/*PcloudCloudinstancesVolumesPutOK handles this case with default header values. +/* PcloudCloudinstancesVolumesPutOK describes a response with status code 200, with default header values. OK */ @@ -88,6 +80,9 @@ type PcloudCloudinstancesVolumesPutOK struct { func (o *PcloudCloudinstancesVolumesPutOK) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}][%d] pcloudCloudinstancesVolumesPutOK %+v", 200, o.Payload) } +func (o *PcloudCloudinstancesVolumesPutOK) GetPayload() *models.Volume { + return o.Payload +} func (o *PcloudCloudinstancesVolumesPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -106,7 +101,7 @@ func NewPcloudCloudinstancesVolumesPutBadRequest() *PcloudCloudinstancesVolumesP return &PcloudCloudinstancesVolumesPutBadRequest{} } -/*PcloudCloudinstancesVolumesPutBadRequest handles this case with default header values. +/* PcloudCloudinstancesVolumesPutBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -117,6 +112,9 @@ type PcloudCloudinstancesVolumesPutBadRequest struct { func (o *PcloudCloudinstancesVolumesPutBadRequest) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}][%d] pcloudCloudinstancesVolumesPutBadRequest %+v", 400, o.Payload) } +func (o *PcloudCloudinstancesVolumesPutBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesVolumesPutBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -135,7 +133,7 @@ func NewPcloudCloudinstancesVolumesPutUnauthorized() *PcloudCloudinstancesVolume return &PcloudCloudinstancesVolumesPutUnauthorized{} } -/*PcloudCloudinstancesVolumesPutUnauthorized handles this case with default header values. +/* PcloudCloudinstancesVolumesPutUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -146,6 +144,9 @@ type PcloudCloudinstancesVolumesPutUnauthorized struct { func (o *PcloudCloudinstancesVolumesPutUnauthorized) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}][%d] pcloudCloudinstancesVolumesPutUnauthorized %+v", 401, o.Payload) } +func (o *PcloudCloudinstancesVolumesPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesVolumesPutUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -164,7 +165,7 @@ func NewPcloudCloudinstancesVolumesPutConflict() *PcloudCloudinstancesVolumesPut return &PcloudCloudinstancesVolumesPutConflict{} } -/*PcloudCloudinstancesVolumesPutConflict handles this case with default header values. +/* PcloudCloudinstancesVolumesPutConflict describes a response with status code 409, with default header values. Conflict */ @@ -175,6 +176,9 @@ type PcloudCloudinstancesVolumesPutConflict struct { func (o *PcloudCloudinstancesVolumesPutConflict) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}][%d] pcloudCloudinstancesVolumesPutConflict %+v", 409, o.Payload) } +func (o *PcloudCloudinstancesVolumesPutConflict) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesVolumesPutConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -193,7 +197,7 @@ func NewPcloudCloudinstancesVolumesPutUnprocessableEntity() *PcloudCloudinstance return &PcloudCloudinstancesVolumesPutUnprocessableEntity{} } -/*PcloudCloudinstancesVolumesPutUnprocessableEntity handles this case with default header values. +/* PcloudCloudinstancesVolumesPutUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -204,6 +208,9 @@ type PcloudCloudinstancesVolumesPutUnprocessableEntity struct { func (o *PcloudCloudinstancesVolumesPutUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}][%d] pcloudCloudinstancesVolumesPutUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudCloudinstancesVolumesPutUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesVolumesPutUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -222,7 +229,7 @@ func NewPcloudCloudinstancesVolumesPutInternalServerError() *PcloudCloudinstance return &PcloudCloudinstancesVolumesPutInternalServerError{} } -/*PcloudCloudinstancesVolumesPutInternalServerError handles this case with default header values. +/* PcloudCloudinstancesVolumesPutInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -233,6 +240,9 @@ type PcloudCloudinstancesVolumesPutInternalServerError struct { func (o *PcloudCloudinstancesVolumesPutInternalServerError) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}][%d] pcloudCloudinstancesVolumesPutInternalServerError %+v", 500, o.Payload) } +func (o *PcloudCloudinstancesVolumesPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudCloudinstancesVolumesPutInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_delete_parameters.go b/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_delete_parameters.go index d4a1b2e8..0facc81b 100644 --- a/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_delete_parameters.go +++ b/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_delete_parameters.go @@ -13,67 +13,67 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudPvminstancesVolumesDeleteParams creates a new PcloudPvminstancesVolumesDeleteParams object -// with the default values initialized. +// NewPcloudPvminstancesVolumesDeleteParams creates a new PcloudPvminstancesVolumesDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudPvminstancesVolumesDeleteParams() *PcloudPvminstancesVolumesDeleteParams { - var () return &PcloudPvminstancesVolumesDeleteParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudPvminstancesVolumesDeleteParamsWithTimeout creates a new PcloudPvminstancesVolumesDeleteParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudPvminstancesVolumesDeleteParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesVolumesDeleteParams { - var () return &PcloudPvminstancesVolumesDeleteParams{ - timeout: timeout, } } // NewPcloudPvminstancesVolumesDeleteParamsWithContext creates a new PcloudPvminstancesVolumesDeleteParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudPvminstancesVolumesDeleteParamsWithContext(ctx context.Context) *PcloudPvminstancesVolumesDeleteParams { - var () return &PcloudPvminstancesVolumesDeleteParams{ - Context: ctx, } } // NewPcloudPvminstancesVolumesDeleteParamsWithHTTPClient creates a new PcloudPvminstancesVolumesDeleteParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudPvminstancesVolumesDeleteParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesVolumesDeleteParams { - var () return &PcloudPvminstancesVolumesDeleteParams{ HTTPClient: client, } } -/*PcloudPvminstancesVolumesDeleteParams contains all the parameters to send to the API endpoint -for the pcloud pvminstances volumes delete operation typically these are written to a http.Request +/* PcloudPvminstancesVolumesDeleteParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances volumes delete operation. + + Typically these are written to a http.Request. */ type PcloudPvminstancesVolumesDeleteParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*PvmInstanceID - PCloud PVM Instance ID + /* PvmInstanceID. + + PCloud PVM Instance ID */ PvmInstanceID string - /*VolumeID - Volume ID + /* VolumeID. + + Volume ID */ VolumeID string @@ -82,6 +82,21 @@ type PcloudPvminstancesVolumesDeleteParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud pvminstances volumes delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesVolumesDeleteParams) WithDefaults() *PcloudPvminstancesVolumesDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances volumes delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesVolumesDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud pvminstances volumes delete params func (o *PcloudPvminstancesVolumesDeleteParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesVolumesDeleteParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_delete_responses.go b/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_delete_responses.go index 1a039e67..7965aa2c 100644 --- a/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_delete_responses.go +++ b/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_delete_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudPvminstancesVolumesDeleteReader is a Reader for the PcloudPvminstancesVolumesDelete structure. @@ -24,58 +23,50 @@ type PcloudPvminstancesVolumesDeleteReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudPvminstancesVolumesDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 202: result := NewPcloudPvminstancesVolumesDeleteAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudPvminstancesVolumesDeleteBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudPvminstancesVolumesDeleteUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 403: result := NewPcloudPvminstancesVolumesDeleteForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudPvminstancesVolumesDeleteNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 409: result := NewPcloudPvminstancesVolumesDeleteConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudPvminstancesVolumesDeleteInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -84,7 +75,7 @@ func NewPcloudPvminstancesVolumesDeleteAccepted() *PcloudPvminstancesVolumesDele return &PcloudPvminstancesVolumesDeleteAccepted{} } -/*PcloudPvminstancesVolumesDeleteAccepted handles this case with default header values. +/* PcloudPvminstancesVolumesDeleteAccepted describes a response with status code 202, with default header values. OK */ @@ -95,6 +86,9 @@ type PcloudPvminstancesVolumesDeleteAccepted struct { func (o *PcloudPvminstancesVolumesDeleteAccepted) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesDeleteAccepted %+v", 202, o.Payload) } +func (o *PcloudPvminstancesVolumesDeleteAccepted) GetPayload() models.Object { + return o.Payload +} func (o *PcloudPvminstancesVolumesDeleteAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -111,7 +105,7 @@ func NewPcloudPvminstancesVolumesDeleteBadRequest() *PcloudPvminstancesVolumesDe return &PcloudPvminstancesVolumesDeleteBadRequest{} } -/*PcloudPvminstancesVolumesDeleteBadRequest handles this case with default header values. +/* PcloudPvminstancesVolumesDeleteBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -122,6 +116,9 @@ type PcloudPvminstancesVolumesDeleteBadRequest struct { func (o *PcloudPvminstancesVolumesDeleteBadRequest) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesDeleteBadRequest %+v", 400, o.Payload) } +func (o *PcloudPvminstancesVolumesDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesVolumesDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -140,7 +137,7 @@ func NewPcloudPvminstancesVolumesDeleteUnauthorized() *PcloudPvminstancesVolumes return &PcloudPvminstancesVolumesDeleteUnauthorized{} } -/*PcloudPvminstancesVolumesDeleteUnauthorized handles this case with default header values. +/* PcloudPvminstancesVolumesDeleteUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -151,6 +148,9 @@ type PcloudPvminstancesVolumesDeleteUnauthorized struct { func (o *PcloudPvminstancesVolumesDeleteUnauthorized) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesDeleteUnauthorized %+v", 401, o.Payload) } +func (o *PcloudPvminstancesVolumesDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesVolumesDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -169,7 +169,7 @@ func NewPcloudPvminstancesVolumesDeleteForbidden() *PcloudPvminstancesVolumesDel return &PcloudPvminstancesVolumesDeleteForbidden{} } -/*PcloudPvminstancesVolumesDeleteForbidden handles this case with default header values. +/* PcloudPvminstancesVolumesDeleteForbidden describes a response with status code 403, with default header values. Forbidden */ @@ -180,6 +180,9 @@ type PcloudPvminstancesVolumesDeleteForbidden struct { func (o *PcloudPvminstancesVolumesDeleteForbidden) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesDeleteForbidden %+v", 403, o.Payload) } +func (o *PcloudPvminstancesVolumesDeleteForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesVolumesDeleteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -198,7 +201,7 @@ func NewPcloudPvminstancesVolumesDeleteNotFound() *PcloudPvminstancesVolumesDele return &PcloudPvminstancesVolumesDeleteNotFound{} } -/*PcloudPvminstancesVolumesDeleteNotFound handles this case with default header values. +/* PcloudPvminstancesVolumesDeleteNotFound describes a response with status code 404, with default header values. Not Found */ @@ -209,6 +212,9 @@ type PcloudPvminstancesVolumesDeleteNotFound struct { func (o *PcloudPvminstancesVolumesDeleteNotFound) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesDeleteNotFound %+v", 404, o.Payload) } +func (o *PcloudPvminstancesVolumesDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesVolumesDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -227,7 +233,7 @@ func NewPcloudPvminstancesVolumesDeleteConflict() *PcloudPvminstancesVolumesDele return &PcloudPvminstancesVolumesDeleteConflict{} } -/*PcloudPvminstancesVolumesDeleteConflict handles this case with default header values. +/* PcloudPvminstancesVolumesDeleteConflict describes a response with status code 409, with default header values. Conflict */ @@ -238,6 +244,9 @@ type PcloudPvminstancesVolumesDeleteConflict struct { func (o *PcloudPvminstancesVolumesDeleteConflict) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesDeleteConflict %+v", 409, o.Payload) } +func (o *PcloudPvminstancesVolumesDeleteConflict) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesVolumesDeleteConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -256,7 +265,7 @@ func NewPcloudPvminstancesVolumesDeleteInternalServerError() *PcloudPvminstances return &PcloudPvminstancesVolumesDeleteInternalServerError{} } -/*PcloudPvminstancesVolumesDeleteInternalServerError handles this case with default header values. +/* PcloudPvminstancesVolumesDeleteInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -267,6 +276,9 @@ type PcloudPvminstancesVolumesDeleteInternalServerError struct { func (o *PcloudPvminstancesVolumesDeleteInternalServerError) Error() string { return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesDeleteInternalServerError %+v", 500, o.Payload) } +func (o *PcloudPvminstancesVolumesDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesVolumesDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_get_parameters.go b/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_get_parameters.go index ecd4ea66..0307f189 100644 --- a/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_get_parameters.go +++ b/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_get_parameters.go @@ -13,67 +13,67 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudPvminstancesVolumesGetParams creates a new PcloudPvminstancesVolumesGetParams object -// with the default values initialized. +// NewPcloudPvminstancesVolumesGetParams creates a new PcloudPvminstancesVolumesGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudPvminstancesVolumesGetParams() *PcloudPvminstancesVolumesGetParams { - var () return &PcloudPvminstancesVolumesGetParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudPvminstancesVolumesGetParamsWithTimeout creates a new PcloudPvminstancesVolumesGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudPvminstancesVolumesGetParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesVolumesGetParams { - var () return &PcloudPvminstancesVolumesGetParams{ - timeout: timeout, } } // NewPcloudPvminstancesVolumesGetParamsWithContext creates a new PcloudPvminstancesVolumesGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudPvminstancesVolumesGetParamsWithContext(ctx context.Context) *PcloudPvminstancesVolumesGetParams { - var () return &PcloudPvminstancesVolumesGetParams{ - Context: ctx, } } // NewPcloudPvminstancesVolumesGetParamsWithHTTPClient creates a new PcloudPvminstancesVolumesGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudPvminstancesVolumesGetParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesVolumesGetParams { - var () return &PcloudPvminstancesVolumesGetParams{ HTTPClient: client, } } -/*PcloudPvminstancesVolumesGetParams contains all the parameters to send to the API endpoint -for the pcloud pvminstances volumes get operation typically these are written to a http.Request +/* PcloudPvminstancesVolumesGetParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances volumes get operation. + + Typically these are written to a http.Request. */ type PcloudPvminstancesVolumesGetParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*PvmInstanceID - PCloud PVM Instance ID + /* PvmInstanceID. + + PCloud PVM Instance ID */ PvmInstanceID string - /*VolumeID - Volume ID + /* VolumeID. + + Volume ID */ VolumeID string @@ -82,6 +82,21 @@ type PcloudPvminstancesVolumesGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud pvminstances volumes get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesVolumesGetParams) WithDefaults() *PcloudPvminstancesVolumesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances volumes get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesVolumesGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud pvminstances volumes get params func (o *PcloudPvminstancesVolumesGetParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesVolumesGetParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_get_responses.go b/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_get_responses.go index 4a52ebd3..fa119079 100644 --- a/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_get_responses.go +++ b/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudPvminstancesVolumesGetReader is a Reader for the PcloudPvminstancesVolumesGet structure. @@ -24,44 +23,38 @@ type PcloudPvminstancesVolumesGetReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudPvminstancesVolumesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudPvminstancesVolumesGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudPvminstancesVolumesGetBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudPvminstancesVolumesGetUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudPvminstancesVolumesGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudPvminstancesVolumesGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudPvminstancesVolumesGetOK() *PcloudPvminstancesVolumesGetOK { return &PcloudPvminstancesVolumesGetOK{} } -/*PcloudPvminstancesVolumesGetOK handles this case with default header values. +/* PcloudPvminstancesVolumesGetOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudPvminstancesVolumesGetOK struct { func (o *PcloudPvminstancesVolumesGetOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesGetOK %+v", 200, o.Payload) } +func (o *PcloudPvminstancesVolumesGetOK) GetPayload() *models.Volume { + return o.Payload +} func (o *PcloudPvminstancesVolumesGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudPvminstancesVolumesGetBadRequest() *PcloudPvminstancesVolumesGetBa return &PcloudPvminstancesVolumesGetBadRequest{} } -/*PcloudPvminstancesVolumesGetBadRequest handles this case with default header values. +/* PcloudPvminstancesVolumesGetBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudPvminstancesVolumesGetBadRequest struct { func (o *PcloudPvminstancesVolumesGetBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesGetBadRequest %+v", 400, o.Payload) } +func (o *PcloudPvminstancesVolumesGetBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesVolumesGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudPvminstancesVolumesGetUnauthorized() *PcloudPvminstancesVolumesGet return &PcloudPvminstancesVolumesGetUnauthorized{} } -/*PcloudPvminstancesVolumesGetUnauthorized handles this case with default header values. +/* PcloudPvminstancesVolumesGetUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudPvminstancesVolumesGetUnauthorized struct { func (o *PcloudPvminstancesVolumesGetUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesGetUnauthorized %+v", 401, o.Payload) } +func (o *PcloudPvminstancesVolumesGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesVolumesGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudPvminstancesVolumesGetNotFound() *PcloudPvminstancesVolumesGetNotF return &PcloudPvminstancesVolumesGetNotFound{} } -/*PcloudPvminstancesVolumesGetNotFound handles this case with default header values. +/* PcloudPvminstancesVolumesGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -168,6 +170,9 @@ type PcloudPvminstancesVolumesGetNotFound struct { func (o *PcloudPvminstancesVolumesGetNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesGetNotFound %+v", 404, o.Payload) } +func (o *PcloudPvminstancesVolumesGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesVolumesGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudPvminstancesVolumesGetInternalServerError() *PcloudPvminstancesVol return &PcloudPvminstancesVolumesGetInternalServerError{} } -/*PcloudPvminstancesVolumesGetInternalServerError handles this case with default header values. +/* PcloudPvminstancesVolumesGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudPvminstancesVolumesGetInternalServerError struct { func (o *PcloudPvminstancesVolumesGetInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesGetInternalServerError %+v", 500, o.Payload) } +func (o *PcloudPvminstancesVolumesGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesVolumesGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_getall_parameters.go b/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_getall_parameters.go index f07597d3..ad7ca531 100644 --- a/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_getall_parameters.go +++ b/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_getall_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudPvminstancesVolumesGetallParams creates a new PcloudPvminstancesVolumesGetallParams object -// with the default values initialized. +// NewPcloudPvminstancesVolumesGetallParams creates a new PcloudPvminstancesVolumesGetallParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudPvminstancesVolumesGetallParams() *PcloudPvminstancesVolumesGetallParams { - var () return &PcloudPvminstancesVolumesGetallParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudPvminstancesVolumesGetallParamsWithTimeout creates a new PcloudPvminstancesVolumesGetallParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudPvminstancesVolumesGetallParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesVolumesGetallParams { - var () return &PcloudPvminstancesVolumesGetallParams{ - timeout: timeout, } } // NewPcloudPvminstancesVolumesGetallParamsWithContext creates a new PcloudPvminstancesVolumesGetallParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudPvminstancesVolumesGetallParamsWithContext(ctx context.Context) *PcloudPvminstancesVolumesGetallParams { - var () return &PcloudPvminstancesVolumesGetallParams{ - Context: ctx, } } // NewPcloudPvminstancesVolumesGetallParamsWithHTTPClient creates a new PcloudPvminstancesVolumesGetallParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudPvminstancesVolumesGetallParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesVolumesGetallParams { - var () return &PcloudPvminstancesVolumesGetallParams{ HTTPClient: client, } } -/*PcloudPvminstancesVolumesGetallParams contains all the parameters to send to the API endpoint -for the pcloud pvminstances volumes getall operation typically these are written to a http.Request +/* PcloudPvminstancesVolumesGetallParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances volumes getall operation. + + Typically these are written to a http.Request. */ type PcloudPvminstancesVolumesGetallParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*PvmInstanceID - PCloud PVM Instance ID + /* PvmInstanceID. + + PCloud PVM Instance ID */ PvmInstanceID string @@ -77,6 +76,21 @@ type PcloudPvminstancesVolumesGetallParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud pvminstances volumes getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesVolumesGetallParams) WithDefaults() *PcloudPvminstancesVolumesGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances volumes getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesVolumesGetallParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud pvminstances volumes getall params func (o *PcloudPvminstancesVolumesGetallParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesVolumesGetallParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_getall_responses.go b/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_getall_responses.go index 37315da8..7e983529 100644 --- a/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_getall_responses.go +++ b/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_getall_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudPvminstancesVolumesGetallReader is a Reader for the PcloudPvminstancesVolumesGetall structure. @@ -24,44 +23,38 @@ type PcloudPvminstancesVolumesGetallReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudPvminstancesVolumesGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudPvminstancesVolumesGetallOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudPvminstancesVolumesGetallBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudPvminstancesVolumesGetallUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudPvminstancesVolumesGetallNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudPvminstancesVolumesGetallInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudPvminstancesVolumesGetallOK() *PcloudPvminstancesVolumesGetallOK { return &PcloudPvminstancesVolumesGetallOK{} } -/*PcloudPvminstancesVolumesGetallOK handles this case with default header values. +/* PcloudPvminstancesVolumesGetallOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudPvminstancesVolumesGetallOK struct { func (o *PcloudPvminstancesVolumesGetallOK) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes][%d] pcloudPvminstancesVolumesGetallOK %+v", 200, o.Payload) } +func (o *PcloudPvminstancesVolumesGetallOK) GetPayload() *models.Volumes { + return o.Payload +} func (o *PcloudPvminstancesVolumesGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudPvminstancesVolumesGetallBadRequest() *PcloudPvminstancesVolumesGe return &PcloudPvminstancesVolumesGetallBadRequest{} } -/*PcloudPvminstancesVolumesGetallBadRequest handles this case with default header values. +/* PcloudPvminstancesVolumesGetallBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudPvminstancesVolumesGetallBadRequest struct { func (o *PcloudPvminstancesVolumesGetallBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes][%d] pcloudPvminstancesVolumesGetallBadRequest %+v", 400, o.Payload) } +func (o *PcloudPvminstancesVolumesGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesVolumesGetallBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudPvminstancesVolumesGetallUnauthorized() *PcloudPvminstancesVolumes return &PcloudPvminstancesVolumesGetallUnauthorized{} } -/*PcloudPvminstancesVolumesGetallUnauthorized handles this case with default header values. +/* PcloudPvminstancesVolumesGetallUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudPvminstancesVolumesGetallUnauthorized struct { func (o *PcloudPvminstancesVolumesGetallUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes][%d] pcloudPvminstancesVolumesGetallUnauthorized %+v", 401, o.Payload) } +func (o *PcloudPvminstancesVolumesGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesVolumesGetallUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudPvminstancesVolumesGetallNotFound() *PcloudPvminstancesVolumesGeta return &PcloudPvminstancesVolumesGetallNotFound{} } -/*PcloudPvminstancesVolumesGetallNotFound handles this case with default header values. +/* PcloudPvminstancesVolumesGetallNotFound describes a response with status code 404, with default header values. Not Found */ @@ -168,6 +170,9 @@ type PcloudPvminstancesVolumesGetallNotFound struct { func (o *PcloudPvminstancesVolumesGetallNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes][%d] pcloudPvminstancesVolumesGetallNotFound %+v", 404, o.Payload) } +func (o *PcloudPvminstancesVolumesGetallNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesVolumesGetallNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudPvminstancesVolumesGetallInternalServerError() *PcloudPvminstances return &PcloudPvminstancesVolumesGetallInternalServerError{} } -/*PcloudPvminstancesVolumesGetallInternalServerError handles this case with default header values. +/* PcloudPvminstancesVolumesGetallInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudPvminstancesVolumesGetallInternalServerError struct { func (o *PcloudPvminstancesVolumesGetallInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes][%d] pcloudPvminstancesVolumesGetallInternalServerError %+v", 500, o.Payload) } +func (o *PcloudPvminstancesVolumesGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesVolumesGetallInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_post_parameters.go b/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_post_parameters.go index 45688ac1..e6144e82 100644 --- a/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_post_parameters.go +++ b/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_post_parameters.go @@ -13,67 +13,67 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudPvminstancesVolumesPostParams creates a new PcloudPvminstancesVolumesPostParams object -// with the default values initialized. +// NewPcloudPvminstancesVolumesPostParams creates a new PcloudPvminstancesVolumesPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudPvminstancesVolumesPostParams() *PcloudPvminstancesVolumesPostParams { - var () return &PcloudPvminstancesVolumesPostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudPvminstancesVolumesPostParamsWithTimeout creates a new PcloudPvminstancesVolumesPostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudPvminstancesVolumesPostParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesVolumesPostParams { - var () return &PcloudPvminstancesVolumesPostParams{ - timeout: timeout, } } // NewPcloudPvminstancesVolumesPostParamsWithContext creates a new PcloudPvminstancesVolumesPostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudPvminstancesVolumesPostParamsWithContext(ctx context.Context) *PcloudPvminstancesVolumesPostParams { - var () return &PcloudPvminstancesVolumesPostParams{ - Context: ctx, } } // NewPcloudPvminstancesVolumesPostParamsWithHTTPClient creates a new PcloudPvminstancesVolumesPostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudPvminstancesVolumesPostParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesVolumesPostParams { - var () return &PcloudPvminstancesVolumesPostParams{ HTTPClient: client, } } -/*PcloudPvminstancesVolumesPostParams contains all the parameters to send to the API endpoint -for the pcloud pvminstances volumes post operation typically these are written to a http.Request +/* PcloudPvminstancesVolumesPostParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances volumes post operation. + + Typically these are written to a http.Request. */ type PcloudPvminstancesVolumesPostParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*PvmInstanceID - PCloud PVM Instance ID + /* PvmInstanceID. + + PCloud PVM Instance ID */ PvmInstanceID string - /*VolumeID - Volume ID + /* VolumeID. + + Volume ID */ VolumeID string @@ -82,6 +82,21 @@ type PcloudPvminstancesVolumesPostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud pvminstances volumes post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesVolumesPostParams) WithDefaults() *PcloudPvminstancesVolumesPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances volumes post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesVolumesPostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud pvminstances volumes post params func (o *PcloudPvminstancesVolumesPostParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesVolumesPostParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_post_responses.go b/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_post_responses.go index fada4f68..85de2ff7 100644 --- a/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_post_responses.go +++ b/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudPvminstancesVolumesPostReader is a Reader for the PcloudPvminstancesVolumesPost structure. @@ -24,58 +23,50 @@ type PcloudPvminstancesVolumesPostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudPvminstancesVolumesPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudPvminstancesVolumesPostOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudPvminstancesVolumesPostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudPvminstancesVolumesPostUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 403: result := NewPcloudPvminstancesVolumesPostForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudPvminstancesVolumesPostNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 409: result := NewPcloudPvminstancesVolumesPostConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudPvminstancesVolumesPostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -84,7 +75,7 @@ func NewPcloudPvminstancesVolumesPostOK() *PcloudPvminstancesVolumesPostOK { return &PcloudPvminstancesVolumesPostOK{} } -/*PcloudPvminstancesVolumesPostOK handles this case with default header values. +/* PcloudPvminstancesVolumesPostOK describes a response with status code 200, with default header values. OK */ @@ -95,6 +86,9 @@ type PcloudPvminstancesVolumesPostOK struct { func (o *PcloudPvminstancesVolumesPostOK) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesPostOK %+v", 200, o.Payload) } +func (o *PcloudPvminstancesVolumesPostOK) GetPayload() models.Object { + return o.Payload +} func (o *PcloudPvminstancesVolumesPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -111,7 +105,7 @@ func NewPcloudPvminstancesVolumesPostBadRequest() *PcloudPvminstancesVolumesPost return &PcloudPvminstancesVolumesPostBadRequest{} } -/*PcloudPvminstancesVolumesPostBadRequest handles this case with default header values. +/* PcloudPvminstancesVolumesPostBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -122,6 +116,9 @@ type PcloudPvminstancesVolumesPostBadRequest struct { func (o *PcloudPvminstancesVolumesPostBadRequest) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesPostBadRequest %+v", 400, o.Payload) } +func (o *PcloudPvminstancesVolumesPostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesVolumesPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -140,7 +137,7 @@ func NewPcloudPvminstancesVolumesPostUnauthorized() *PcloudPvminstancesVolumesPo return &PcloudPvminstancesVolumesPostUnauthorized{} } -/*PcloudPvminstancesVolumesPostUnauthorized handles this case with default header values. +/* PcloudPvminstancesVolumesPostUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -151,6 +148,9 @@ type PcloudPvminstancesVolumesPostUnauthorized struct { func (o *PcloudPvminstancesVolumesPostUnauthorized) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesPostUnauthorized %+v", 401, o.Payload) } +func (o *PcloudPvminstancesVolumesPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesVolumesPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -169,7 +169,7 @@ func NewPcloudPvminstancesVolumesPostForbidden() *PcloudPvminstancesVolumesPostF return &PcloudPvminstancesVolumesPostForbidden{} } -/*PcloudPvminstancesVolumesPostForbidden handles this case with default header values. +/* PcloudPvminstancesVolumesPostForbidden describes a response with status code 403, with default header values. Forbidden */ @@ -180,6 +180,9 @@ type PcloudPvminstancesVolumesPostForbidden struct { func (o *PcloudPvminstancesVolumesPostForbidden) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesPostForbidden %+v", 403, o.Payload) } +func (o *PcloudPvminstancesVolumesPostForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesVolumesPostForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -198,7 +201,7 @@ func NewPcloudPvminstancesVolumesPostNotFound() *PcloudPvminstancesVolumesPostNo return &PcloudPvminstancesVolumesPostNotFound{} } -/*PcloudPvminstancesVolumesPostNotFound handles this case with default header values. +/* PcloudPvminstancesVolumesPostNotFound describes a response with status code 404, with default header values. Not Found */ @@ -209,6 +212,9 @@ type PcloudPvminstancesVolumesPostNotFound struct { func (o *PcloudPvminstancesVolumesPostNotFound) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesPostNotFound %+v", 404, o.Payload) } +func (o *PcloudPvminstancesVolumesPostNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesVolumesPostNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -227,7 +233,7 @@ func NewPcloudPvminstancesVolumesPostConflict() *PcloudPvminstancesVolumesPostCo return &PcloudPvminstancesVolumesPostConflict{} } -/*PcloudPvminstancesVolumesPostConflict handles this case with default header values. +/* PcloudPvminstancesVolumesPostConflict describes a response with status code 409, with default header values. Conflict */ @@ -238,6 +244,9 @@ type PcloudPvminstancesVolumesPostConflict struct { func (o *PcloudPvminstancesVolumesPostConflict) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesPostConflict %+v", 409, o.Payload) } +func (o *PcloudPvminstancesVolumesPostConflict) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesVolumesPostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -256,7 +265,7 @@ func NewPcloudPvminstancesVolumesPostInternalServerError() *PcloudPvminstancesVo return &PcloudPvminstancesVolumesPostInternalServerError{} } -/*PcloudPvminstancesVolumesPostInternalServerError handles this case with default header values. +/* PcloudPvminstancesVolumesPostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -267,6 +276,9 @@ type PcloudPvminstancesVolumesPostInternalServerError struct { func (o *PcloudPvminstancesVolumesPostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesPostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudPvminstancesVolumesPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesVolumesPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_put_parameters.go b/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_put_parameters.go index 3927ed02..01ba400c 100644 --- a/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_put_parameters.go +++ b/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_put_parameters.go @@ -13,74 +13,75 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudPvminstancesVolumesPutParams creates a new PcloudPvminstancesVolumesPutParams object -// with the default values initialized. +// NewPcloudPvminstancesVolumesPutParams creates a new PcloudPvminstancesVolumesPutParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudPvminstancesVolumesPutParams() *PcloudPvminstancesVolumesPutParams { - var () return &PcloudPvminstancesVolumesPutParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudPvminstancesVolumesPutParamsWithTimeout creates a new PcloudPvminstancesVolumesPutParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudPvminstancesVolumesPutParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesVolumesPutParams { - var () return &PcloudPvminstancesVolumesPutParams{ - timeout: timeout, } } // NewPcloudPvminstancesVolumesPutParamsWithContext creates a new PcloudPvminstancesVolumesPutParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudPvminstancesVolumesPutParamsWithContext(ctx context.Context) *PcloudPvminstancesVolumesPutParams { - var () return &PcloudPvminstancesVolumesPutParams{ - Context: ctx, } } // NewPcloudPvminstancesVolumesPutParamsWithHTTPClient creates a new PcloudPvminstancesVolumesPutParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudPvminstancesVolumesPutParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesVolumesPutParams { - var () return &PcloudPvminstancesVolumesPutParams{ HTTPClient: client, } } -/*PcloudPvminstancesVolumesPutParams contains all the parameters to send to the API endpoint -for the pcloud pvminstances volumes put operation typically these are written to a http.Request +/* PcloudPvminstancesVolumesPutParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances volumes put operation. + + Typically these are written to a http.Request. */ type PcloudPvminstancesVolumesPutParams struct { - /*Body - Parameters to update a volume attached to a PVMInstance + /* Body. + Parameters to update a volume attached to a PVMInstance */ Body *models.PVMInstanceVolumeUpdate - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*PvmInstanceID - PCloud PVM Instance ID + /* PvmInstanceID. + + PCloud PVM Instance ID */ PvmInstanceID string - /*VolumeID - Volume ID + /* VolumeID. + + Volume ID */ VolumeID string @@ -89,6 +90,21 @@ type PcloudPvminstancesVolumesPutParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud pvminstances volumes put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesVolumesPutParams) WithDefaults() *PcloudPvminstancesVolumesPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances volumes put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesVolumesPutParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud pvminstances volumes put params func (o *PcloudPvminstancesVolumesPutParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesVolumesPutParams { o.SetTimeout(timeout) @@ -173,7 +189,6 @@ func (o *PcloudPvminstancesVolumesPutParams) WriteToRequest(r runtime.ClientRequ return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_put_responses.go b/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_put_responses.go index 1bf3e1b9..a9da1b15 100644 --- a/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_put_responses.go +++ b/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_put_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudPvminstancesVolumesPutReader is a Reader for the PcloudPvminstancesVolumesPut structure. @@ -24,30 +23,26 @@ type PcloudPvminstancesVolumesPutReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudPvminstancesVolumesPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudPvminstancesVolumesPutOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudPvminstancesVolumesPutBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudPvminstancesVolumesPutInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -56,7 +51,7 @@ func NewPcloudPvminstancesVolumesPutOK() *PcloudPvminstancesVolumesPutOK { return &PcloudPvminstancesVolumesPutOK{} } -/*PcloudPvminstancesVolumesPutOK handles this case with default header values. +/* PcloudPvminstancesVolumesPutOK describes a response with status code 200, with default header values. OK */ @@ -67,6 +62,9 @@ type PcloudPvminstancesVolumesPutOK struct { func (o *PcloudPvminstancesVolumesPutOK) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesPutOK %+v", 200, o.Payload) } +func (o *PcloudPvminstancesVolumesPutOK) GetPayload() models.Object { + return o.Payload +} func (o *PcloudPvminstancesVolumesPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -83,7 +81,7 @@ func NewPcloudPvminstancesVolumesPutBadRequest() *PcloudPvminstancesVolumesPutBa return &PcloudPvminstancesVolumesPutBadRequest{} } -/*PcloudPvminstancesVolumesPutBadRequest handles this case with default header values. +/* PcloudPvminstancesVolumesPutBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -94,6 +92,9 @@ type PcloudPvminstancesVolumesPutBadRequest struct { func (o *PcloudPvminstancesVolumesPutBadRequest) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesPutBadRequest %+v", 400, o.Payload) } +func (o *PcloudPvminstancesVolumesPutBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesVolumesPutBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -112,7 +113,7 @@ func NewPcloudPvminstancesVolumesPutInternalServerError() *PcloudPvminstancesVol return &PcloudPvminstancesVolumesPutInternalServerError{} } -/*PcloudPvminstancesVolumesPutInternalServerError handles this case with default header values. +/* PcloudPvminstancesVolumesPutInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -123,6 +124,9 @@ type PcloudPvminstancesVolumesPutInternalServerError struct { func (o *PcloudPvminstancesVolumesPutInternalServerError) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesPutInternalServerError %+v", 500, o.Payload) } +func (o *PcloudPvminstancesVolumesPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesVolumesPutInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_setboot_put_parameters.go b/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_setboot_put_parameters.go index 00d64201..77fab0cb 100644 --- a/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_setboot_put_parameters.go +++ b/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_setboot_put_parameters.go @@ -13,67 +13,67 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudPvminstancesVolumesSetbootPutParams creates a new PcloudPvminstancesVolumesSetbootPutParams object -// with the default values initialized. +// NewPcloudPvminstancesVolumesSetbootPutParams creates a new PcloudPvminstancesVolumesSetbootPutParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudPvminstancesVolumesSetbootPutParams() *PcloudPvminstancesVolumesSetbootPutParams { - var () return &PcloudPvminstancesVolumesSetbootPutParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudPvminstancesVolumesSetbootPutParamsWithTimeout creates a new PcloudPvminstancesVolumesSetbootPutParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudPvminstancesVolumesSetbootPutParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesVolumesSetbootPutParams { - var () return &PcloudPvminstancesVolumesSetbootPutParams{ - timeout: timeout, } } // NewPcloudPvminstancesVolumesSetbootPutParamsWithContext creates a new PcloudPvminstancesVolumesSetbootPutParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudPvminstancesVolumesSetbootPutParamsWithContext(ctx context.Context) *PcloudPvminstancesVolumesSetbootPutParams { - var () return &PcloudPvminstancesVolumesSetbootPutParams{ - Context: ctx, } } // NewPcloudPvminstancesVolumesSetbootPutParamsWithHTTPClient creates a new PcloudPvminstancesVolumesSetbootPutParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudPvminstancesVolumesSetbootPutParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesVolumesSetbootPutParams { - var () return &PcloudPvminstancesVolumesSetbootPutParams{ HTTPClient: client, } } -/*PcloudPvminstancesVolumesSetbootPutParams contains all the parameters to send to the API endpoint -for the pcloud pvminstances volumes setboot put operation typically these are written to a http.Request +/* PcloudPvminstancesVolumesSetbootPutParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances volumes setboot put operation. + + Typically these are written to a http.Request. */ type PcloudPvminstancesVolumesSetbootPutParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*PvmInstanceID - PCloud PVM Instance ID + /* PvmInstanceID. + + PCloud PVM Instance ID */ PvmInstanceID string - /*VolumeID - Volume ID + /* VolumeID. + + Volume ID */ VolumeID string @@ -82,6 +82,21 @@ type PcloudPvminstancesVolumesSetbootPutParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud pvminstances volumes setboot put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesVolumesSetbootPutParams) WithDefaults() *PcloudPvminstancesVolumesSetbootPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances volumes setboot put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesVolumesSetbootPutParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud pvminstances volumes setboot put params func (o *PcloudPvminstancesVolumesSetbootPutParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesVolumesSetbootPutParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_setboot_put_responses.go b/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_setboot_put_responses.go index e34c9623..0842e8f1 100644 --- a/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_setboot_put_responses.go +++ b/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_setboot_put_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudPvminstancesVolumesSetbootPutReader is a Reader for the PcloudPvminstancesVolumesSetbootPut structure. @@ -24,44 +23,38 @@ type PcloudPvminstancesVolumesSetbootPutReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudPvminstancesVolumesSetbootPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudPvminstancesVolumesSetbootPutOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudPvminstancesVolumesSetbootPutBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudPvminstancesVolumesSetbootPutUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudPvminstancesVolumesSetbootPutNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudPvminstancesVolumesSetbootPutInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudPvminstancesVolumesSetbootPutOK() *PcloudPvminstancesVolumesSetboo return &PcloudPvminstancesVolumesSetbootPutOK{} } -/*PcloudPvminstancesVolumesSetbootPutOK handles this case with default header values. +/* PcloudPvminstancesVolumesSetbootPutOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudPvminstancesVolumesSetbootPutOK struct { func (o *PcloudPvminstancesVolumesSetbootPutOK) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}/setboot][%d] pcloudPvminstancesVolumesSetbootPutOK %+v", 200, o.Payload) } +func (o *PcloudPvminstancesVolumesSetbootPutOK) GetPayload() models.Object { + return o.Payload +} func (o *PcloudPvminstancesVolumesSetbootPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -97,7 +93,7 @@ func NewPcloudPvminstancesVolumesSetbootPutBadRequest() *PcloudPvminstancesVolum return &PcloudPvminstancesVolumesSetbootPutBadRequest{} } -/*PcloudPvminstancesVolumesSetbootPutBadRequest handles this case with default header values. +/* PcloudPvminstancesVolumesSetbootPutBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -108,6 +104,9 @@ type PcloudPvminstancesVolumesSetbootPutBadRequest struct { func (o *PcloudPvminstancesVolumesSetbootPutBadRequest) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}/setboot][%d] pcloudPvminstancesVolumesSetbootPutBadRequest %+v", 400, o.Payload) } +func (o *PcloudPvminstancesVolumesSetbootPutBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesVolumesSetbootPutBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -126,7 +125,7 @@ func NewPcloudPvminstancesVolumesSetbootPutUnauthorized() *PcloudPvminstancesVol return &PcloudPvminstancesVolumesSetbootPutUnauthorized{} } -/*PcloudPvminstancesVolumesSetbootPutUnauthorized handles this case with default header values. +/* PcloudPvminstancesVolumesSetbootPutUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -137,6 +136,9 @@ type PcloudPvminstancesVolumesSetbootPutUnauthorized struct { func (o *PcloudPvminstancesVolumesSetbootPutUnauthorized) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}/setboot][%d] pcloudPvminstancesVolumesSetbootPutUnauthorized %+v", 401, o.Payload) } +func (o *PcloudPvminstancesVolumesSetbootPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesVolumesSetbootPutUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -155,7 +157,7 @@ func NewPcloudPvminstancesVolumesSetbootPutNotFound() *PcloudPvminstancesVolumes return &PcloudPvminstancesVolumesSetbootPutNotFound{} } -/*PcloudPvminstancesVolumesSetbootPutNotFound handles this case with default header values. +/* PcloudPvminstancesVolumesSetbootPutNotFound describes a response with status code 404, with default header values. Not Found */ @@ -166,6 +168,9 @@ type PcloudPvminstancesVolumesSetbootPutNotFound struct { func (o *PcloudPvminstancesVolumesSetbootPutNotFound) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}/setboot][%d] pcloudPvminstancesVolumesSetbootPutNotFound %+v", 404, o.Payload) } +func (o *PcloudPvminstancesVolumesSetbootPutNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesVolumesSetbootPutNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -184,7 +189,7 @@ func NewPcloudPvminstancesVolumesSetbootPutInternalServerError() *PcloudPvminsta return &PcloudPvminstancesVolumesSetbootPutInternalServerError{} } -/*PcloudPvminstancesVolumesSetbootPutInternalServerError handles this case with default header values. +/* PcloudPvminstancesVolumesSetbootPutInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -195,6 +200,9 @@ type PcloudPvminstancesVolumesSetbootPutInternalServerError struct { func (o *PcloudPvminstancesVolumesSetbootPutInternalServerError) Error() string { return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}/setboot][%d] pcloudPvminstancesVolumesSetbootPutInternalServerError %+v", 500, o.Payload) } +func (o *PcloudPvminstancesVolumesSetbootPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudPvminstancesVolumesSetbootPutInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_volumes/pcloud_v2_pvminstances_volumes_post_parameters.go b/power/client/p_cloud_volumes/pcloud_v2_pvminstances_volumes_post_parameters.go index a9331aeb..ba0f3192 100644 --- a/power/client/p_cloud_volumes/pcloud_v2_pvminstances_volumes_post_parameters.go +++ b/power/client/p_cloud_volumes/pcloud_v2_pvminstances_volumes_post_parameters.go @@ -13,69 +13,69 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudV2PvminstancesVolumesPostParams creates a new PcloudV2PvminstancesVolumesPostParams object -// with the default values initialized. +// NewPcloudV2PvminstancesVolumesPostParams creates a new PcloudV2PvminstancesVolumesPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudV2PvminstancesVolumesPostParams() *PcloudV2PvminstancesVolumesPostParams { - var () return &PcloudV2PvminstancesVolumesPostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudV2PvminstancesVolumesPostParamsWithTimeout creates a new PcloudV2PvminstancesVolumesPostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudV2PvminstancesVolumesPostParamsWithTimeout(timeout time.Duration) *PcloudV2PvminstancesVolumesPostParams { - var () return &PcloudV2PvminstancesVolumesPostParams{ - timeout: timeout, } } // NewPcloudV2PvminstancesVolumesPostParamsWithContext creates a new PcloudV2PvminstancesVolumesPostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudV2PvminstancesVolumesPostParamsWithContext(ctx context.Context) *PcloudV2PvminstancesVolumesPostParams { - var () return &PcloudV2PvminstancesVolumesPostParams{ - Context: ctx, } } // NewPcloudV2PvminstancesVolumesPostParamsWithHTTPClient creates a new PcloudV2PvminstancesVolumesPostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudV2PvminstancesVolumesPostParamsWithHTTPClient(client *http.Client) *PcloudV2PvminstancesVolumesPostParams { - var () return &PcloudV2PvminstancesVolumesPostParams{ HTTPClient: client, } } -/*PcloudV2PvminstancesVolumesPostParams contains all the parameters to send to the API endpoint -for the pcloud v2 pvminstances volumes post operation typically these are written to a http.Request +/* PcloudV2PvminstancesVolumesPostParams contains all the parameters to send to the API endpoint + for the pcloud v2 pvminstances volumes post operation. + + Typically these are written to a http.Request. */ type PcloudV2PvminstancesVolumesPostParams struct { - /*Body - Parameter to attach volumes to a PVMInstance + /* Body. + Parameter to attach volumes to a PVMInstance */ Body *models.VolumesAttach - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*PvmInstanceID - PCloud PVM Instance ID + /* PvmInstanceID. + + PCloud PVM Instance ID */ PvmInstanceID string @@ -84,6 +84,21 @@ type PcloudV2PvminstancesVolumesPostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud v2 pvminstances volumes post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2PvminstancesVolumesPostParams) WithDefaults() *PcloudV2PvminstancesVolumesPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v2 pvminstances volumes post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2PvminstancesVolumesPostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud v2 pvminstances volumes post params func (o *PcloudV2PvminstancesVolumesPostParams) WithTimeout(timeout time.Duration) *PcloudV2PvminstancesVolumesPostParams { o.SetTimeout(timeout) @@ -157,7 +172,6 @@ func (o *PcloudV2PvminstancesVolumesPostParams) WriteToRequest(r runtime.ClientR return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_volumes/pcloud_v2_pvminstances_volumes_post_responses.go b/power/client/p_cloud_volumes/pcloud_v2_pvminstances_volumes_post_responses.go index 8bb87252..e7c8a6c5 100644 --- a/power/client/p_cloud_volumes/pcloud_v2_pvminstances_volumes_post_responses.go +++ b/power/client/p_cloud_volumes/pcloud_v2_pvminstances_volumes_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudV2PvminstancesVolumesPostReader is a Reader for the PcloudV2PvminstancesVolumesPost structure. @@ -24,44 +23,38 @@ type PcloudV2PvminstancesVolumesPostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudV2PvminstancesVolumesPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 202: result := NewPcloudV2PvminstancesVolumesPostAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudV2PvminstancesVolumesPostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudV2PvminstancesVolumesPostUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudV2PvminstancesVolumesPostNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudV2PvminstancesVolumesPostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudV2PvminstancesVolumesPostAccepted() *PcloudV2PvminstancesVolumesPo return &PcloudV2PvminstancesVolumesPostAccepted{} } -/*PcloudV2PvminstancesVolumesPostAccepted handles this case with default header values. +/* PcloudV2PvminstancesVolumesPostAccepted describes a response with status code 202, with default header values. Accepted */ @@ -81,6 +74,9 @@ type PcloudV2PvminstancesVolumesPostAccepted struct { func (o *PcloudV2PvminstancesVolumesPostAccepted) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes][%d] pcloudV2PvminstancesVolumesPostAccepted %+v", 202, o.Payload) } +func (o *PcloudV2PvminstancesVolumesPostAccepted) GetPayload() *models.VolumesAttachmentResponse { + return o.Payload +} func (o *PcloudV2PvminstancesVolumesPostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudV2PvminstancesVolumesPostBadRequest() *PcloudV2PvminstancesVolumes return &PcloudV2PvminstancesVolumesPostBadRequest{} } -/*PcloudV2PvminstancesVolumesPostBadRequest handles this case with default header values. +/* PcloudV2PvminstancesVolumesPostBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudV2PvminstancesVolumesPostBadRequest struct { func (o *PcloudV2PvminstancesVolumesPostBadRequest) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes][%d] pcloudV2PvminstancesVolumesPostBadRequest %+v", 400, o.Payload) } +func (o *PcloudV2PvminstancesVolumesPostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2PvminstancesVolumesPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudV2PvminstancesVolumesPostUnauthorized() *PcloudV2PvminstancesVolum return &PcloudV2PvminstancesVolumesPostUnauthorized{} } -/*PcloudV2PvminstancesVolumesPostUnauthorized handles this case with default header values. +/* PcloudV2PvminstancesVolumesPostUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudV2PvminstancesVolumesPostUnauthorized struct { func (o *PcloudV2PvminstancesVolumesPostUnauthorized) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes][%d] pcloudV2PvminstancesVolumesPostUnauthorized %+v", 401, o.Payload) } +func (o *PcloudV2PvminstancesVolumesPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2PvminstancesVolumesPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudV2PvminstancesVolumesPostNotFound() *PcloudV2PvminstancesVolumesPo return &PcloudV2PvminstancesVolumesPostNotFound{} } -/*PcloudV2PvminstancesVolumesPostNotFound handles this case with default header values. +/* PcloudV2PvminstancesVolumesPostNotFound describes a response with status code 404, with default header values. Not Found */ @@ -168,6 +170,9 @@ type PcloudV2PvminstancesVolumesPostNotFound struct { func (o *PcloudV2PvminstancesVolumesPostNotFound) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes][%d] pcloudV2PvminstancesVolumesPostNotFound %+v", 404, o.Payload) } +func (o *PcloudV2PvminstancesVolumesPostNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2PvminstancesVolumesPostNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudV2PvminstancesVolumesPostInternalServerError() *PcloudV2Pvminstanc return &PcloudV2PvminstancesVolumesPostInternalServerError{} } -/*PcloudV2PvminstancesVolumesPostInternalServerError handles this case with default header values. +/* PcloudV2PvminstancesVolumesPostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudV2PvminstancesVolumesPostInternalServerError struct { func (o *PcloudV2PvminstancesVolumesPostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes][%d] pcloudV2PvminstancesVolumesPostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudV2PvminstancesVolumesPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2PvminstancesVolumesPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_volumes/pcloud_v2_volumes_clone_post_parameters.go b/power/client/p_cloud_volumes/pcloud_v2_volumes_clone_post_parameters.go index 57f303cd..99a119e9 100644 --- a/power/client/p_cloud_volumes/pcloud_v2_volumes_clone_post_parameters.go +++ b/power/client/p_cloud_volumes/pcloud_v2_volumes_clone_post_parameters.go @@ -13,64 +13,63 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudV2VolumesClonePostParams creates a new PcloudV2VolumesClonePostParams object -// with the default values initialized. +// NewPcloudV2VolumesClonePostParams creates a new PcloudV2VolumesClonePostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudV2VolumesClonePostParams() *PcloudV2VolumesClonePostParams { - var () return &PcloudV2VolumesClonePostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudV2VolumesClonePostParamsWithTimeout creates a new PcloudV2VolumesClonePostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudV2VolumesClonePostParamsWithTimeout(timeout time.Duration) *PcloudV2VolumesClonePostParams { - var () return &PcloudV2VolumesClonePostParams{ - timeout: timeout, } } // NewPcloudV2VolumesClonePostParamsWithContext creates a new PcloudV2VolumesClonePostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudV2VolumesClonePostParamsWithContext(ctx context.Context) *PcloudV2VolumesClonePostParams { - var () return &PcloudV2VolumesClonePostParams{ - Context: ctx, } } // NewPcloudV2VolumesClonePostParamsWithHTTPClient creates a new PcloudV2VolumesClonePostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudV2VolumesClonePostParamsWithHTTPClient(client *http.Client) *PcloudV2VolumesClonePostParams { - var () return &PcloudV2VolumesClonePostParams{ HTTPClient: client, } } -/*PcloudV2VolumesClonePostParams contains all the parameters to send to the API endpoint -for the pcloud v2 volumes clone post operation typically these are written to a http.Request +/* PcloudV2VolumesClonePostParams contains all the parameters to send to the API endpoint + for the pcloud v2 volumes clone post operation. + + Typically these are written to a http.Request. */ type PcloudV2VolumesClonePostParams struct { - /*Body - Parameters for the cloning of volumes + /* Body. + Parameters for the cloning of volumes */ Body *models.VolumesCloneAsyncRequest - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -79,6 +78,21 @@ type PcloudV2VolumesClonePostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud v2 volumes clone post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumesClonePostParams) WithDefaults() *PcloudV2VolumesClonePostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v2 volumes clone post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumesClonePostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud v2 volumes clone post params func (o *PcloudV2VolumesClonePostParams) WithTimeout(timeout time.Duration) *PcloudV2VolumesClonePostParams { o.SetTimeout(timeout) @@ -141,7 +155,6 @@ func (o *PcloudV2VolumesClonePostParams) WriteToRequest(r runtime.ClientRequest, return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_volumes/pcloud_v2_volumes_clone_post_responses.go b/power/client/p_cloud_volumes/pcloud_v2_volumes_clone_post_responses.go index 24bb6d00..17b686b2 100644 --- a/power/client/p_cloud_volumes/pcloud_v2_volumes_clone_post_responses.go +++ b/power/client/p_cloud_volumes/pcloud_v2_volumes_clone_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudV2VolumesClonePostReader is a Reader for the PcloudV2VolumesClonePost structure. @@ -24,44 +23,38 @@ type PcloudV2VolumesClonePostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudV2VolumesClonePostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 202: result := NewPcloudV2VolumesClonePostAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudV2VolumesClonePostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudV2VolumesClonePostUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudV2VolumesClonePostNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudV2VolumesClonePostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudV2VolumesClonePostAccepted() *PcloudV2VolumesClonePostAccepted { return &PcloudV2VolumesClonePostAccepted{} } -/*PcloudV2VolumesClonePostAccepted handles this case with default header values. +/* PcloudV2VolumesClonePostAccepted describes a response with status code 202, with default header values. Accepted */ @@ -81,6 +74,9 @@ type PcloudV2VolumesClonePostAccepted struct { func (o *PcloudV2VolumesClonePostAccepted) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes/clone][%d] pcloudV2VolumesClonePostAccepted %+v", 202, o.Payload) } +func (o *PcloudV2VolumesClonePostAccepted) GetPayload() *models.CloneTaskReference { + return o.Payload +} func (o *PcloudV2VolumesClonePostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudV2VolumesClonePostBadRequest() *PcloudV2VolumesClonePostBadRequest return &PcloudV2VolumesClonePostBadRequest{} } -/*PcloudV2VolumesClonePostBadRequest handles this case with default header values. +/* PcloudV2VolumesClonePostBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudV2VolumesClonePostBadRequest struct { func (o *PcloudV2VolumesClonePostBadRequest) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes/clone][%d] pcloudV2VolumesClonePostBadRequest %+v", 400, o.Payload) } +func (o *PcloudV2VolumesClonePostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumesClonePostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudV2VolumesClonePostUnauthorized() *PcloudV2VolumesClonePostUnauthor return &PcloudV2VolumesClonePostUnauthorized{} } -/*PcloudV2VolumesClonePostUnauthorized handles this case with default header values. +/* PcloudV2VolumesClonePostUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudV2VolumesClonePostUnauthorized struct { func (o *PcloudV2VolumesClonePostUnauthorized) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes/clone][%d] pcloudV2VolumesClonePostUnauthorized %+v", 401, o.Payload) } +func (o *PcloudV2VolumesClonePostUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumesClonePostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudV2VolumesClonePostNotFound() *PcloudV2VolumesClonePostNotFound { return &PcloudV2VolumesClonePostNotFound{} } -/*PcloudV2VolumesClonePostNotFound handles this case with default header values. +/* PcloudV2VolumesClonePostNotFound describes a response with status code 404, with default header values. Not Found */ @@ -168,6 +170,9 @@ type PcloudV2VolumesClonePostNotFound struct { func (o *PcloudV2VolumesClonePostNotFound) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes/clone][%d] pcloudV2VolumesClonePostNotFound %+v", 404, o.Payload) } +func (o *PcloudV2VolumesClonePostNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumesClonePostNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudV2VolumesClonePostInternalServerError() *PcloudV2VolumesClonePostI return &PcloudV2VolumesClonePostInternalServerError{} } -/*PcloudV2VolumesClonePostInternalServerError handles this case with default header values. +/* PcloudV2VolumesClonePostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudV2VolumesClonePostInternalServerError struct { func (o *PcloudV2VolumesClonePostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes/clone][%d] pcloudV2VolumesClonePostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudV2VolumesClonePostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumesClonePostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_volumes/pcloud_v2_volumes_clonetasks_get_parameters.go b/power/client/p_cloud_volumes/pcloud_v2_volumes_clonetasks_get_parameters.go index 93b3aa56..b75497e1 100644 --- a/power/client/p_cloud_volumes/pcloud_v2_volumes_clonetasks_get_parameters.go +++ b/power/client/p_cloud_volumes/pcloud_v2_volumes_clonetasks_get_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudV2VolumesClonetasksGetParams creates a new PcloudV2VolumesClonetasksGetParams object -// with the default values initialized. +// NewPcloudV2VolumesClonetasksGetParams creates a new PcloudV2VolumesClonetasksGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudV2VolumesClonetasksGetParams() *PcloudV2VolumesClonetasksGetParams { - var () return &PcloudV2VolumesClonetasksGetParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudV2VolumesClonetasksGetParamsWithTimeout creates a new PcloudV2VolumesClonetasksGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudV2VolumesClonetasksGetParamsWithTimeout(timeout time.Duration) *PcloudV2VolumesClonetasksGetParams { - var () return &PcloudV2VolumesClonetasksGetParams{ - timeout: timeout, } } // NewPcloudV2VolumesClonetasksGetParamsWithContext creates a new PcloudV2VolumesClonetasksGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudV2VolumesClonetasksGetParamsWithContext(ctx context.Context) *PcloudV2VolumesClonetasksGetParams { - var () return &PcloudV2VolumesClonetasksGetParams{ - Context: ctx, } } // NewPcloudV2VolumesClonetasksGetParamsWithHTTPClient creates a new PcloudV2VolumesClonetasksGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudV2VolumesClonetasksGetParamsWithHTTPClient(client *http.Client) *PcloudV2VolumesClonetasksGetParams { - var () return &PcloudV2VolumesClonetasksGetParams{ HTTPClient: client, } } -/*PcloudV2VolumesClonetasksGetParams contains all the parameters to send to the API endpoint -for the pcloud v2 volumes clonetasks get operation typically these are written to a http.Request +/* PcloudV2VolumesClonetasksGetParams contains all the parameters to send to the API endpoint + for the pcloud v2 volumes clonetasks get operation. + + Typically these are written to a http.Request. */ type PcloudV2VolumesClonetasksGetParams struct { - /*CloneTaskID - Volumes Clone Task ID + /* CloneTaskID. + Volumes Clone Task ID */ CloneTaskID string - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -77,6 +76,21 @@ type PcloudV2VolumesClonetasksGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud v2 volumes clonetasks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumesClonetasksGetParams) WithDefaults() *PcloudV2VolumesClonetasksGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v2 volumes clonetasks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumesClonetasksGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud v2 volumes clonetasks get params func (o *PcloudV2VolumesClonetasksGetParams) WithTimeout(timeout time.Duration) *PcloudV2VolumesClonetasksGetParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_volumes/pcloud_v2_volumes_clonetasks_get_responses.go b/power/client/p_cloud_volumes/pcloud_v2_volumes_clonetasks_get_responses.go index bbba347e..a5949186 100644 --- a/power/client/p_cloud_volumes/pcloud_v2_volumes_clonetasks_get_responses.go +++ b/power/client/p_cloud_volumes/pcloud_v2_volumes_clonetasks_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudV2VolumesClonetasksGetReader is a Reader for the PcloudV2VolumesClonetasksGet structure. @@ -24,51 +23,44 @@ type PcloudV2VolumesClonetasksGetReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudV2VolumesClonetasksGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudV2VolumesClonetasksGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudV2VolumesClonetasksGetBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudV2VolumesClonetasksGetUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudV2VolumesClonetasksGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 409: result := NewPcloudV2VolumesClonetasksGetConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudV2VolumesClonetasksGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -77,7 +69,7 @@ func NewPcloudV2VolumesClonetasksGetOK() *PcloudV2VolumesClonetasksGetOK { return &PcloudV2VolumesClonetasksGetOK{} } -/*PcloudV2VolumesClonetasksGetOK handles this case with default header values. +/* PcloudV2VolumesClonetasksGetOK describes a response with status code 200, with default header values. OK */ @@ -88,6 +80,9 @@ type PcloudV2VolumesClonetasksGetOK struct { func (o *PcloudV2VolumesClonetasksGetOK) Error() string { return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes/clone-tasks/{clone_task_id}][%d] pcloudV2VolumesClonetasksGetOK %+v", 200, o.Payload) } +func (o *PcloudV2VolumesClonetasksGetOK) GetPayload() *models.CloneTaskStatus { + return o.Payload +} func (o *PcloudV2VolumesClonetasksGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -106,7 +101,7 @@ func NewPcloudV2VolumesClonetasksGetBadRequest() *PcloudV2VolumesClonetasksGetBa return &PcloudV2VolumesClonetasksGetBadRequest{} } -/*PcloudV2VolumesClonetasksGetBadRequest handles this case with default header values. +/* PcloudV2VolumesClonetasksGetBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -117,6 +112,9 @@ type PcloudV2VolumesClonetasksGetBadRequest struct { func (o *PcloudV2VolumesClonetasksGetBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes/clone-tasks/{clone_task_id}][%d] pcloudV2VolumesClonetasksGetBadRequest %+v", 400, o.Payload) } +func (o *PcloudV2VolumesClonetasksGetBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumesClonetasksGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -135,7 +133,7 @@ func NewPcloudV2VolumesClonetasksGetUnauthorized() *PcloudV2VolumesClonetasksGet return &PcloudV2VolumesClonetasksGetUnauthorized{} } -/*PcloudV2VolumesClonetasksGetUnauthorized handles this case with default header values. +/* PcloudV2VolumesClonetasksGetUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -146,6 +144,9 @@ type PcloudV2VolumesClonetasksGetUnauthorized struct { func (o *PcloudV2VolumesClonetasksGetUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes/clone-tasks/{clone_task_id}][%d] pcloudV2VolumesClonetasksGetUnauthorized %+v", 401, o.Payload) } +func (o *PcloudV2VolumesClonetasksGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumesClonetasksGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -164,7 +165,7 @@ func NewPcloudV2VolumesClonetasksGetNotFound() *PcloudV2VolumesClonetasksGetNotF return &PcloudV2VolumesClonetasksGetNotFound{} } -/*PcloudV2VolumesClonetasksGetNotFound handles this case with default header values. +/* PcloudV2VolumesClonetasksGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -175,6 +176,9 @@ type PcloudV2VolumesClonetasksGetNotFound struct { func (o *PcloudV2VolumesClonetasksGetNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes/clone-tasks/{clone_task_id}][%d] pcloudV2VolumesClonetasksGetNotFound %+v", 404, o.Payload) } +func (o *PcloudV2VolumesClonetasksGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumesClonetasksGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -193,7 +197,7 @@ func NewPcloudV2VolumesClonetasksGetConflict() *PcloudV2VolumesClonetasksGetConf return &PcloudV2VolumesClonetasksGetConflict{} } -/*PcloudV2VolumesClonetasksGetConflict handles this case with default header values. +/* PcloudV2VolumesClonetasksGetConflict describes a response with status code 409, with default header values. Conflict */ @@ -204,6 +208,9 @@ type PcloudV2VolumesClonetasksGetConflict struct { func (o *PcloudV2VolumesClonetasksGetConflict) Error() string { return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes/clone-tasks/{clone_task_id}][%d] pcloudV2VolumesClonetasksGetConflict %+v", 409, o.Payload) } +func (o *PcloudV2VolumesClonetasksGetConflict) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumesClonetasksGetConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -222,7 +229,7 @@ func NewPcloudV2VolumesClonetasksGetInternalServerError() *PcloudV2VolumesClonet return &PcloudV2VolumesClonetasksGetInternalServerError{} } -/*PcloudV2VolumesClonetasksGetInternalServerError handles this case with default header values. +/* PcloudV2VolumesClonetasksGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -233,6 +240,9 @@ type PcloudV2VolumesClonetasksGetInternalServerError struct { func (o *PcloudV2VolumesClonetasksGetInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes/clone-tasks/{clone_task_id}][%d] pcloudV2VolumesClonetasksGetInternalServerError %+v", 500, o.Payload) } +func (o *PcloudV2VolumesClonetasksGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumesClonetasksGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_volumes/pcloud_v2_volumes_post_parameters.go b/power/client/p_cloud_volumes/pcloud_v2_volumes_post_parameters.go index 8b845c01..6ec3d108 100644 --- a/power/client/p_cloud_volumes/pcloud_v2_volumes_post_parameters.go +++ b/power/client/p_cloud_volumes/pcloud_v2_volumes_post_parameters.go @@ -13,64 +13,63 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudV2VolumesPostParams creates a new PcloudV2VolumesPostParams object -// with the default values initialized. +// NewPcloudV2VolumesPostParams creates a new PcloudV2VolumesPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudV2VolumesPostParams() *PcloudV2VolumesPostParams { - var () return &PcloudV2VolumesPostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudV2VolumesPostParamsWithTimeout creates a new PcloudV2VolumesPostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudV2VolumesPostParamsWithTimeout(timeout time.Duration) *PcloudV2VolumesPostParams { - var () return &PcloudV2VolumesPostParams{ - timeout: timeout, } } // NewPcloudV2VolumesPostParamsWithContext creates a new PcloudV2VolumesPostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudV2VolumesPostParamsWithContext(ctx context.Context) *PcloudV2VolumesPostParams { - var () return &PcloudV2VolumesPostParams{ - Context: ctx, } } // NewPcloudV2VolumesPostParamsWithHTTPClient creates a new PcloudV2VolumesPostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudV2VolumesPostParamsWithHTTPClient(client *http.Client) *PcloudV2VolumesPostParams { - var () return &PcloudV2VolumesPostParams{ HTTPClient: client, } } -/*PcloudV2VolumesPostParams contains all the parameters to send to the API endpoint -for the pcloud v2 volumes post operation typically these are written to a http.Request +/* PcloudV2VolumesPostParams contains all the parameters to send to the API endpoint + for the pcloud v2 volumes post operation. + + Typically these are written to a http.Request. */ type PcloudV2VolumesPostParams struct { - /*Body - Parameters for creating multiple volumes + /* Body. + Parameters for creating multiple volumes */ Body *models.MultiVolumesCreate - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -79,6 +78,21 @@ type PcloudV2VolumesPostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud v2 volumes post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumesPostParams) WithDefaults() *PcloudV2VolumesPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v2 volumes post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumesPostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud v2 volumes post params func (o *PcloudV2VolumesPostParams) WithTimeout(timeout time.Duration) *PcloudV2VolumesPostParams { o.SetTimeout(timeout) @@ -141,7 +155,6 @@ func (o *PcloudV2VolumesPostParams) WriteToRequest(r runtime.ClientRequest, reg return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_volumes/pcloud_v2_volumes_post_responses.go b/power/client/p_cloud_volumes/pcloud_v2_volumes_post_responses.go index 69414ddb..7101f333 100644 --- a/power/client/p_cloud_volumes/pcloud_v2_volumes_post_responses.go +++ b/power/client/p_cloud_volumes/pcloud_v2_volumes_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudV2VolumesPostReader is a Reader for the PcloudV2VolumesPost structure. @@ -24,51 +23,44 @@ type PcloudV2VolumesPostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudV2VolumesPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 201: result := NewPcloudV2VolumesPostCreated() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudV2VolumesPostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudV2VolumesPostUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 409: result := NewPcloudV2VolumesPostConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewPcloudV2VolumesPostUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudV2VolumesPostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -77,7 +69,7 @@ func NewPcloudV2VolumesPostCreated() *PcloudV2VolumesPostCreated { return &PcloudV2VolumesPostCreated{} } -/*PcloudV2VolumesPostCreated handles this case with default header values. +/* PcloudV2VolumesPostCreated describes a response with status code 201, with default header values. Created */ @@ -88,6 +80,9 @@ type PcloudV2VolumesPostCreated struct { func (o *PcloudV2VolumesPostCreated) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesPostCreated %+v", 201, o.Payload) } +func (o *PcloudV2VolumesPostCreated) GetPayload() *models.Volumes { + return o.Payload +} func (o *PcloudV2VolumesPostCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -106,7 +101,7 @@ func NewPcloudV2VolumesPostBadRequest() *PcloudV2VolumesPostBadRequest { return &PcloudV2VolumesPostBadRequest{} } -/*PcloudV2VolumesPostBadRequest handles this case with default header values. +/* PcloudV2VolumesPostBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -117,6 +112,9 @@ type PcloudV2VolumesPostBadRequest struct { func (o *PcloudV2VolumesPostBadRequest) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesPostBadRequest %+v", 400, o.Payload) } +func (o *PcloudV2VolumesPostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumesPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -135,7 +133,7 @@ func NewPcloudV2VolumesPostUnauthorized() *PcloudV2VolumesPostUnauthorized { return &PcloudV2VolumesPostUnauthorized{} } -/*PcloudV2VolumesPostUnauthorized handles this case with default header values. +/* PcloudV2VolumesPostUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -146,6 +144,9 @@ type PcloudV2VolumesPostUnauthorized struct { func (o *PcloudV2VolumesPostUnauthorized) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesPostUnauthorized %+v", 401, o.Payload) } +func (o *PcloudV2VolumesPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumesPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -164,7 +165,7 @@ func NewPcloudV2VolumesPostConflict() *PcloudV2VolumesPostConflict { return &PcloudV2VolumesPostConflict{} } -/*PcloudV2VolumesPostConflict handles this case with default header values. +/* PcloudV2VolumesPostConflict describes a response with status code 409, with default header values. Conflict */ @@ -175,6 +176,9 @@ type PcloudV2VolumesPostConflict struct { func (o *PcloudV2VolumesPostConflict) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesPostConflict %+v", 409, o.Payload) } +func (o *PcloudV2VolumesPostConflict) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumesPostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -193,7 +197,7 @@ func NewPcloudV2VolumesPostUnprocessableEntity() *PcloudV2VolumesPostUnprocessab return &PcloudV2VolumesPostUnprocessableEntity{} } -/*PcloudV2VolumesPostUnprocessableEntity handles this case with default header values. +/* PcloudV2VolumesPostUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -204,6 +208,9 @@ type PcloudV2VolumesPostUnprocessableEntity struct { func (o *PcloudV2VolumesPostUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesPostUnprocessableEntity %+v", 422, o.Payload) } +func (o *PcloudV2VolumesPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumesPostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -222,7 +229,7 @@ func NewPcloudV2VolumesPostInternalServerError() *PcloudV2VolumesPostInternalSer return &PcloudV2VolumesPostInternalServerError{} } -/*PcloudV2VolumesPostInternalServerError handles this case with default header values. +/* PcloudV2VolumesPostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -233,6 +240,9 @@ type PcloudV2VolumesPostInternalServerError struct { func (o *PcloudV2VolumesPostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesPostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudV2VolumesPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumesPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_volumes/pcloud_v2_volumesclone_cancel_post_parameters.go b/power/client/p_cloud_volumes/pcloud_v2_volumesclone_cancel_post_parameters.go index c9c6ef71..a71bc1d7 100644 --- a/power/client/p_cloud_volumes/pcloud_v2_volumesclone_cancel_post_parameters.go +++ b/power/client/p_cloud_volumes/pcloud_v2_volumesclone_cancel_post_parameters.go @@ -13,69 +13,69 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudV2VolumescloneCancelPostParams creates a new PcloudV2VolumescloneCancelPostParams object -// with the default values initialized. +// NewPcloudV2VolumescloneCancelPostParams creates a new PcloudV2VolumescloneCancelPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudV2VolumescloneCancelPostParams() *PcloudV2VolumescloneCancelPostParams { - var () return &PcloudV2VolumescloneCancelPostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudV2VolumescloneCancelPostParamsWithTimeout creates a new PcloudV2VolumescloneCancelPostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudV2VolumescloneCancelPostParamsWithTimeout(timeout time.Duration) *PcloudV2VolumescloneCancelPostParams { - var () return &PcloudV2VolumescloneCancelPostParams{ - timeout: timeout, } } // NewPcloudV2VolumescloneCancelPostParamsWithContext creates a new PcloudV2VolumescloneCancelPostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudV2VolumescloneCancelPostParamsWithContext(ctx context.Context) *PcloudV2VolumescloneCancelPostParams { - var () return &PcloudV2VolumescloneCancelPostParams{ - Context: ctx, } } // NewPcloudV2VolumescloneCancelPostParamsWithHTTPClient creates a new PcloudV2VolumescloneCancelPostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudV2VolumescloneCancelPostParamsWithHTTPClient(client *http.Client) *PcloudV2VolumescloneCancelPostParams { - var () return &PcloudV2VolumescloneCancelPostParams{ HTTPClient: client, } } -/*PcloudV2VolumescloneCancelPostParams contains all the parameters to send to the API endpoint -for the pcloud v2 volumesclone cancel post operation typically these are written to a http.Request +/* PcloudV2VolumescloneCancelPostParams contains all the parameters to send to the API endpoint + for the pcloud v2 volumesclone cancel post operation. + + Typically these are written to a http.Request. */ type PcloudV2VolumescloneCancelPostParams struct { - /*Body - Parameters for cancelling a volumes-clone request + /* Body. + Parameters for cancelling a volumes-clone request */ Body *models.VolumesCloneCancel - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*VolumesCloneID - Volumes Clone ID + /* VolumesCloneID. + + Volumes Clone ID */ VolumesCloneID string @@ -84,6 +84,21 @@ type PcloudV2VolumescloneCancelPostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud v2 volumesclone cancel post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumescloneCancelPostParams) WithDefaults() *PcloudV2VolumescloneCancelPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v2 volumesclone cancel post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumescloneCancelPostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud v2 volumesclone cancel post params func (o *PcloudV2VolumescloneCancelPostParams) WithTimeout(timeout time.Duration) *PcloudV2VolumescloneCancelPostParams { o.SetTimeout(timeout) @@ -157,7 +172,6 @@ func (o *PcloudV2VolumescloneCancelPostParams) WriteToRequest(r runtime.ClientRe return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_volumes/pcloud_v2_volumesclone_cancel_post_responses.go b/power/client/p_cloud_volumes/pcloud_v2_volumesclone_cancel_post_responses.go index 74547a7b..3d06fe1b 100644 --- a/power/client/p_cloud_volumes/pcloud_v2_volumesclone_cancel_post_responses.go +++ b/power/client/p_cloud_volumes/pcloud_v2_volumesclone_cancel_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudV2VolumescloneCancelPostReader is a Reader for the PcloudV2VolumescloneCancelPost structure. @@ -24,37 +23,32 @@ type PcloudV2VolumescloneCancelPostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudV2VolumescloneCancelPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 202: result := NewPcloudV2VolumescloneCancelPostAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 401: result := NewPcloudV2VolumescloneCancelPostUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudV2VolumescloneCancelPostNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudV2VolumescloneCancelPostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -63,7 +57,7 @@ func NewPcloudV2VolumescloneCancelPostAccepted() *PcloudV2VolumescloneCancelPost return &PcloudV2VolumescloneCancelPostAccepted{} } -/*PcloudV2VolumescloneCancelPostAccepted handles this case with default header values. +/* PcloudV2VolumescloneCancelPostAccepted describes a response with status code 202, with default header values. Accepted */ @@ -74,6 +68,9 @@ type PcloudV2VolumescloneCancelPostAccepted struct { func (o *PcloudV2VolumescloneCancelPostAccepted) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}/cancel][%d] pcloudV2VolumescloneCancelPostAccepted %+v", 202, o.Payload) } +func (o *PcloudV2VolumescloneCancelPostAccepted) GetPayload() *models.VolumesClone { + return o.Payload +} func (o *PcloudV2VolumescloneCancelPostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -92,7 +89,7 @@ func NewPcloudV2VolumescloneCancelPostUnauthorized() *PcloudV2VolumescloneCancel return &PcloudV2VolumescloneCancelPostUnauthorized{} } -/*PcloudV2VolumescloneCancelPostUnauthorized handles this case with default header values. +/* PcloudV2VolumescloneCancelPostUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -103,6 +100,9 @@ type PcloudV2VolumescloneCancelPostUnauthorized struct { func (o *PcloudV2VolumescloneCancelPostUnauthorized) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}/cancel][%d] pcloudV2VolumescloneCancelPostUnauthorized %+v", 401, o.Payload) } +func (o *PcloudV2VolumescloneCancelPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumescloneCancelPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -121,7 +121,7 @@ func NewPcloudV2VolumescloneCancelPostNotFound() *PcloudV2VolumescloneCancelPost return &PcloudV2VolumescloneCancelPostNotFound{} } -/*PcloudV2VolumescloneCancelPostNotFound handles this case with default header values. +/* PcloudV2VolumescloneCancelPostNotFound describes a response with status code 404, with default header values. Not Found */ @@ -132,6 +132,9 @@ type PcloudV2VolumescloneCancelPostNotFound struct { func (o *PcloudV2VolumescloneCancelPostNotFound) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}/cancel][%d] pcloudV2VolumescloneCancelPostNotFound %+v", 404, o.Payload) } +func (o *PcloudV2VolumescloneCancelPostNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumescloneCancelPostNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -150,7 +153,7 @@ func NewPcloudV2VolumescloneCancelPostInternalServerError() *PcloudV2Volumesclon return &PcloudV2VolumescloneCancelPostInternalServerError{} } -/*PcloudV2VolumescloneCancelPostInternalServerError handles this case with default header values. +/* PcloudV2VolumescloneCancelPostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -161,6 +164,9 @@ type PcloudV2VolumescloneCancelPostInternalServerError struct { func (o *PcloudV2VolumescloneCancelPostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}/cancel][%d] pcloudV2VolumescloneCancelPostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudV2VolumescloneCancelPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumescloneCancelPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_volumes/pcloud_v2_volumesclone_delete_parameters.go b/power/client/p_cloud_volumes/pcloud_v2_volumesclone_delete_parameters.go index 49a56a1f..bee81198 100644 --- a/power/client/p_cloud_volumes/pcloud_v2_volumesclone_delete_parameters.go +++ b/power/client/p_cloud_volumes/pcloud_v2_volumesclone_delete_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudV2VolumescloneDeleteParams creates a new PcloudV2VolumescloneDeleteParams object -// with the default values initialized. +// NewPcloudV2VolumescloneDeleteParams creates a new PcloudV2VolumescloneDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudV2VolumescloneDeleteParams() *PcloudV2VolumescloneDeleteParams { - var () return &PcloudV2VolumescloneDeleteParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudV2VolumescloneDeleteParamsWithTimeout creates a new PcloudV2VolumescloneDeleteParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudV2VolumescloneDeleteParamsWithTimeout(timeout time.Duration) *PcloudV2VolumescloneDeleteParams { - var () return &PcloudV2VolumescloneDeleteParams{ - timeout: timeout, } } // NewPcloudV2VolumescloneDeleteParamsWithContext creates a new PcloudV2VolumescloneDeleteParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudV2VolumescloneDeleteParamsWithContext(ctx context.Context) *PcloudV2VolumescloneDeleteParams { - var () return &PcloudV2VolumescloneDeleteParams{ - Context: ctx, } } // NewPcloudV2VolumescloneDeleteParamsWithHTTPClient creates a new PcloudV2VolumescloneDeleteParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudV2VolumescloneDeleteParamsWithHTTPClient(client *http.Client) *PcloudV2VolumescloneDeleteParams { - var () return &PcloudV2VolumescloneDeleteParams{ HTTPClient: client, } } -/*PcloudV2VolumescloneDeleteParams contains all the parameters to send to the API endpoint -for the pcloud v2 volumesclone delete operation typically these are written to a http.Request +/* PcloudV2VolumescloneDeleteParams contains all the parameters to send to the API endpoint + for the pcloud v2 volumesclone delete operation. + + Typically these are written to a http.Request. */ type PcloudV2VolumescloneDeleteParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*VolumesCloneID - Volumes Clone ID + /* VolumesCloneID. + + Volumes Clone ID */ VolumesCloneID string @@ -77,6 +76,21 @@ type PcloudV2VolumescloneDeleteParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud v2 volumesclone delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumescloneDeleteParams) WithDefaults() *PcloudV2VolumescloneDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v2 volumesclone delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumescloneDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud v2 volumesclone delete params func (o *PcloudV2VolumescloneDeleteParams) WithTimeout(timeout time.Duration) *PcloudV2VolumescloneDeleteParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_volumes/pcloud_v2_volumesclone_delete_responses.go b/power/client/p_cloud_volumes/pcloud_v2_volumesclone_delete_responses.go index 3869fc69..2dc153ac 100644 --- a/power/client/p_cloud_volumes/pcloud_v2_volumesclone_delete_responses.go +++ b/power/client/p_cloud_volumes/pcloud_v2_volumesclone_delete_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudV2VolumescloneDeleteReader is a Reader for the PcloudV2VolumescloneDelete structure. @@ -24,44 +23,38 @@ type PcloudV2VolumescloneDeleteReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudV2VolumescloneDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudV2VolumescloneDeleteOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudV2VolumescloneDeleteBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudV2VolumescloneDeleteUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudV2VolumescloneDeleteNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudV2VolumescloneDeleteInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudV2VolumescloneDeleteOK() *PcloudV2VolumescloneDeleteOK { return &PcloudV2VolumescloneDeleteOK{} } -/*PcloudV2VolumescloneDeleteOK handles this case with default header values. +/* PcloudV2VolumescloneDeleteOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudV2VolumescloneDeleteOK struct { func (o *PcloudV2VolumescloneDeleteOK) Error() string { return fmt.Sprintf("[DELETE /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}][%d] pcloudV2VolumescloneDeleteOK %+v", 200, o.Payload) } +func (o *PcloudV2VolumescloneDeleteOK) GetPayload() models.Object { + return o.Payload +} func (o *PcloudV2VolumescloneDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -97,7 +93,7 @@ func NewPcloudV2VolumescloneDeleteBadRequest() *PcloudV2VolumescloneDeleteBadReq return &PcloudV2VolumescloneDeleteBadRequest{} } -/*PcloudV2VolumescloneDeleteBadRequest handles this case with default header values. +/* PcloudV2VolumescloneDeleteBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -108,6 +104,9 @@ type PcloudV2VolumescloneDeleteBadRequest struct { func (o *PcloudV2VolumescloneDeleteBadRequest) Error() string { return fmt.Sprintf("[DELETE /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}][%d] pcloudV2VolumescloneDeleteBadRequest %+v", 400, o.Payload) } +func (o *PcloudV2VolumescloneDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumescloneDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -126,7 +125,7 @@ func NewPcloudV2VolumescloneDeleteUnauthorized() *PcloudV2VolumescloneDeleteUnau return &PcloudV2VolumescloneDeleteUnauthorized{} } -/*PcloudV2VolumescloneDeleteUnauthorized handles this case with default header values. +/* PcloudV2VolumescloneDeleteUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -137,6 +136,9 @@ type PcloudV2VolumescloneDeleteUnauthorized struct { func (o *PcloudV2VolumescloneDeleteUnauthorized) Error() string { return fmt.Sprintf("[DELETE /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}][%d] pcloudV2VolumescloneDeleteUnauthorized %+v", 401, o.Payload) } +func (o *PcloudV2VolumescloneDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumescloneDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -155,7 +157,7 @@ func NewPcloudV2VolumescloneDeleteNotFound() *PcloudV2VolumescloneDeleteNotFound return &PcloudV2VolumescloneDeleteNotFound{} } -/*PcloudV2VolumescloneDeleteNotFound handles this case with default header values. +/* PcloudV2VolumescloneDeleteNotFound describes a response with status code 404, with default header values. Not Found */ @@ -166,6 +168,9 @@ type PcloudV2VolumescloneDeleteNotFound struct { func (o *PcloudV2VolumescloneDeleteNotFound) Error() string { return fmt.Sprintf("[DELETE /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}][%d] pcloudV2VolumescloneDeleteNotFound %+v", 404, o.Payload) } +func (o *PcloudV2VolumescloneDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumescloneDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -184,7 +189,7 @@ func NewPcloudV2VolumescloneDeleteInternalServerError() *PcloudV2VolumescloneDel return &PcloudV2VolumescloneDeleteInternalServerError{} } -/*PcloudV2VolumescloneDeleteInternalServerError handles this case with default header values. +/* PcloudV2VolumescloneDeleteInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -195,6 +200,9 @@ type PcloudV2VolumescloneDeleteInternalServerError struct { func (o *PcloudV2VolumescloneDeleteInternalServerError) Error() string { return fmt.Sprintf("[DELETE /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}][%d] pcloudV2VolumescloneDeleteInternalServerError %+v", 500, o.Payload) } +func (o *PcloudV2VolumescloneDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumescloneDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_volumes/pcloud_v2_volumesclone_execute_post_parameters.go b/power/client/p_cloud_volumes/pcloud_v2_volumesclone_execute_post_parameters.go index 222da1c3..f3d74219 100644 --- a/power/client/p_cloud_volumes/pcloud_v2_volumesclone_execute_post_parameters.go +++ b/power/client/p_cloud_volumes/pcloud_v2_volumesclone_execute_post_parameters.go @@ -13,69 +13,69 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudV2VolumescloneExecutePostParams creates a new PcloudV2VolumescloneExecutePostParams object -// with the default values initialized. +// NewPcloudV2VolumescloneExecutePostParams creates a new PcloudV2VolumescloneExecutePostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudV2VolumescloneExecutePostParams() *PcloudV2VolumescloneExecutePostParams { - var () return &PcloudV2VolumescloneExecutePostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudV2VolumescloneExecutePostParamsWithTimeout creates a new PcloudV2VolumescloneExecutePostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudV2VolumescloneExecutePostParamsWithTimeout(timeout time.Duration) *PcloudV2VolumescloneExecutePostParams { - var () return &PcloudV2VolumescloneExecutePostParams{ - timeout: timeout, } } // NewPcloudV2VolumescloneExecutePostParamsWithContext creates a new PcloudV2VolumescloneExecutePostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudV2VolumescloneExecutePostParamsWithContext(ctx context.Context) *PcloudV2VolumescloneExecutePostParams { - var () return &PcloudV2VolumescloneExecutePostParams{ - Context: ctx, } } // NewPcloudV2VolumescloneExecutePostParamsWithHTTPClient creates a new PcloudV2VolumescloneExecutePostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudV2VolumescloneExecutePostParamsWithHTTPClient(client *http.Client) *PcloudV2VolumescloneExecutePostParams { - var () return &PcloudV2VolumescloneExecutePostParams{ HTTPClient: client, } } -/*PcloudV2VolumescloneExecutePostParams contains all the parameters to send to the API endpoint -for the pcloud v2 volumesclone execute post operation typically these are written to a http.Request +/* PcloudV2VolumescloneExecutePostParams contains all the parameters to send to the API endpoint + for the pcloud v2 volumesclone execute post operation. + + Typically these are written to a http.Request. */ type PcloudV2VolumescloneExecutePostParams struct { - /*Body - Parameters for the cloning of volumes + /* Body. + Parameters for the cloning of volumes */ Body *models.VolumesCloneExecute - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*VolumesCloneID - Volumes Clone ID + /* VolumesCloneID. + + Volumes Clone ID */ VolumesCloneID string @@ -84,6 +84,21 @@ type PcloudV2VolumescloneExecutePostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud v2 volumesclone execute post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumescloneExecutePostParams) WithDefaults() *PcloudV2VolumescloneExecutePostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v2 volumesclone execute post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumescloneExecutePostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud v2 volumesclone execute post params func (o *PcloudV2VolumescloneExecutePostParams) WithTimeout(timeout time.Duration) *PcloudV2VolumescloneExecutePostParams { o.SetTimeout(timeout) @@ -157,7 +172,6 @@ func (o *PcloudV2VolumescloneExecutePostParams) WriteToRequest(r runtime.ClientR return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_volumes/pcloud_v2_volumesclone_execute_post_responses.go b/power/client/p_cloud_volumes/pcloud_v2_volumesclone_execute_post_responses.go index d2cb004a..4523d858 100644 --- a/power/client/p_cloud_volumes/pcloud_v2_volumesclone_execute_post_responses.go +++ b/power/client/p_cloud_volumes/pcloud_v2_volumesclone_execute_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudV2VolumescloneExecutePostReader is a Reader for the PcloudV2VolumescloneExecutePost structure. @@ -24,44 +23,38 @@ type PcloudV2VolumescloneExecutePostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudV2VolumescloneExecutePostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 202: result := NewPcloudV2VolumescloneExecutePostAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudV2VolumescloneExecutePostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudV2VolumescloneExecutePostUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudV2VolumescloneExecutePostNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudV2VolumescloneExecutePostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudV2VolumescloneExecutePostAccepted() *PcloudV2VolumescloneExecutePo return &PcloudV2VolumescloneExecutePostAccepted{} } -/*PcloudV2VolumescloneExecutePostAccepted handles this case with default header values. +/* PcloudV2VolumescloneExecutePostAccepted describes a response with status code 202, with default header values. Accepted */ @@ -81,6 +74,9 @@ type PcloudV2VolumescloneExecutePostAccepted struct { func (o *PcloudV2VolumescloneExecutePostAccepted) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}/execute][%d] pcloudV2VolumescloneExecutePostAccepted %+v", 202, o.Payload) } +func (o *PcloudV2VolumescloneExecutePostAccepted) GetPayload() *models.VolumesClone { + return o.Payload +} func (o *PcloudV2VolumescloneExecutePostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudV2VolumescloneExecutePostBadRequest() *PcloudV2VolumescloneExecute return &PcloudV2VolumescloneExecutePostBadRequest{} } -/*PcloudV2VolumescloneExecutePostBadRequest handles this case with default header values. +/* PcloudV2VolumescloneExecutePostBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudV2VolumescloneExecutePostBadRequest struct { func (o *PcloudV2VolumescloneExecutePostBadRequest) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}/execute][%d] pcloudV2VolumescloneExecutePostBadRequest %+v", 400, o.Payload) } +func (o *PcloudV2VolumescloneExecutePostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumescloneExecutePostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudV2VolumescloneExecutePostUnauthorized() *PcloudV2VolumescloneExecu return &PcloudV2VolumescloneExecutePostUnauthorized{} } -/*PcloudV2VolumescloneExecutePostUnauthorized handles this case with default header values. +/* PcloudV2VolumescloneExecutePostUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudV2VolumescloneExecutePostUnauthorized struct { func (o *PcloudV2VolumescloneExecutePostUnauthorized) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}/execute][%d] pcloudV2VolumescloneExecutePostUnauthorized %+v", 401, o.Payload) } +func (o *PcloudV2VolumescloneExecutePostUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumescloneExecutePostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudV2VolumescloneExecutePostNotFound() *PcloudV2VolumescloneExecutePo return &PcloudV2VolumescloneExecutePostNotFound{} } -/*PcloudV2VolumescloneExecutePostNotFound handles this case with default header values. +/* PcloudV2VolumescloneExecutePostNotFound describes a response with status code 404, with default header values. Not Found */ @@ -168,6 +170,9 @@ type PcloudV2VolumescloneExecutePostNotFound struct { func (o *PcloudV2VolumescloneExecutePostNotFound) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}/execute][%d] pcloudV2VolumescloneExecutePostNotFound %+v", 404, o.Payload) } +func (o *PcloudV2VolumescloneExecutePostNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumescloneExecutePostNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudV2VolumescloneExecutePostInternalServerError() *PcloudV2Volumesclo return &PcloudV2VolumescloneExecutePostInternalServerError{} } -/*PcloudV2VolumescloneExecutePostInternalServerError handles this case with default header values. +/* PcloudV2VolumescloneExecutePostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudV2VolumescloneExecutePostInternalServerError struct { func (o *PcloudV2VolumescloneExecutePostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}/execute][%d] pcloudV2VolumescloneExecutePostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudV2VolumescloneExecutePostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumescloneExecutePostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_volumes/pcloud_v2_volumesclone_get_parameters.go b/power/client/p_cloud_volumes/pcloud_v2_volumesclone_get_parameters.go index 47fc5eeb..0a9c293e 100644 --- a/power/client/p_cloud_volumes/pcloud_v2_volumesclone_get_parameters.go +++ b/power/client/p_cloud_volumes/pcloud_v2_volumesclone_get_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudV2VolumescloneGetParams creates a new PcloudV2VolumescloneGetParams object -// with the default values initialized. +// NewPcloudV2VolumescloneGetParams creates a new PcloudV2VolumescloneGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudV2VolumescloneGetParams() *PcloudV2VolumescloneGetParams { - var () return &PcloudV2VolumescloneGetParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudV2VolumescloneGetParamsWithTimeout creates a new PcloudV2VolumescloneGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudV2VolumescloneGetParamsWithTimeout(timeout time.Duration) *PcloudV2VolumescloneGetParams { - var () return &PcloudV2VolumescloneGetParams{ - timeout: timeout, } } // NewPcloudV2VolumescloneGetParamsWithContext creates a new PcloudV2VolumescloneGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudV2VolumescloneGetParamsWithContext(ctx context.Context) *PcloudV2VolumescloneGetParams { - var () return &PcloudV2VolumescloneGetParams{ - Context: ctx, } } // NewPcloudV2VolumescloneGetParamsWithHTTPClient creates a new PcloudV2VolumescloneGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudV2VolumescloneGetParamsWithHTTPClient(client *http.Client) *PcloudV2VolumescloneGetParams { - var () return &PcloudV2VolumescloneGetParams{ HTTPClient: client, } } -/*PcloudV2VolumescloneGetParams contains all the parameters to send to the API endpoint -for the pcloud v2 volumesclone get operation typically these are written to a http.Request +/* PcloudV2VolumescloneGetParams contains all the parameters to send to the API endpoint + for the pcloud v2 volumesclone get operation. + + Typically these are written to a http.Request. */ type PcloudV2VolumescloneGetParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*VolumesCloneID - Volumes Clone ID + /* VolumesCloneID. + + Volumes Clone ID */ VolumesCloneID string @@ -77,6 +76,21 @@ type PcloudV2VolumescloneGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud v2 volumesclone get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumescloneGetParams) WithDefaults() *PcloudV2VolumescloneGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v2 volumesclone get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumescloneGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud v2 volumesclone get params func (o *PcloudV2VolumescloneGetParams) WithTimeout(timeout time.Duration) *PcloudV2VolumescloneGetParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_volumes/pcloud_v2_volumesclone_get_responses.go b/power/client/p_cloud_volumes/pcloud_v2_volumesclone_get_responses.go index 7de160af..f1dfe63f 100644 --- a/power/client/p_cloud_volumes/pcloud_v2_volumesclone_get_responses.go +++ b/power/client/p_cloud_volumes/pcloud_v2_volumesclone_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudV2VolumescloneGetReader is a Reader for the PcloudV2VolumescloneGet structure. @@ -24,44 +23,38 @@ type PcloudV2VolumescloneGetReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudV2VolumescloneGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudV2VolumescloneGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudV2VolumescloneGetBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudV2VolumescloneGetUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudV2VolumescloneGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudV2VolumescloneGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudV2VolumescloneGetOK() *PcloudV2VolumescloneGetOK { return &PcloudV2VolumescloneGetOK{} } -/*PcloudV2VolumescloneGetOK handles this case with default header values. +/* PcloudV2VolumescloneGetOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudV2VolumescloneGetOK struct { func (o *PcloudV2VolumescloneGetOK) Error() string { return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}][%d] pcloudV2VolumescloneGetOK %+v", 200, o.Payload) } +func (o *PcloudV2VolumescloneGetOK) GetPayload() *models.VolumesCloneDetail { + return o.Payload +} func (o *PcloudV2VolumescloneGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudV2VolumescloneGetBadRequest() *PcloudV2VolumescloneGetBadRequest { return &PcloudV2VolumescloneGetBadRequest{} } -/*PcloudV2VolumescloneGetBadRequest handles this case with default header values. +/* PcloudV2VolumescloneGetBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudV2VolumescloneGetBadRequest struct { func (o *PcloudV2VolumescloneGetBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}][%d] pcloudV2VolumescloneGetBadRequest %+v", 400, o.Payload) } +func (o *PcloudV2VolumescloneGetBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumescloneGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudV2VolumescloneGetUnauthorized() *PcloudV2VolumescloneGetUnauthoriz return &PcloudV2VolumescloneGetUnauthorized{} } -/*PcloudV2VolumescloneGetUnauthorized handles this case with default header values. +/* PcloudV2VolumescloneGetUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudV2VolumescloneGetUnauthorized struct { func (o *PcloudV2VolumescloneGetUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}][%d] pcloudV2VolumescloneGetUnauthorized %+v", 401, o.Payload) } +func (o *PcloudV2VolumescloneGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumescloneGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudV2VolumescloneGetNotFound() *PcloudV2VolumescloneGetNotFound { return &PcloudV2VolumescloneGetNotFound{} } -/*PcloudV2VolumescloneGetNotFound handles this case with default header values. +/* PcloudV2VolumescloneGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -168,6 +170,9 @@ type PcloudV2VolumescloneGetNotFound struct { func (o *PcloudV2VolumescloneGetNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}][%d] pcloudV2VolumescloneGetNotFound %+v", 404, o.Payload) } +func (o *PcloudV2VolumescloneGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumescloneGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudV2VolumescloneGetInternalServerError() *PcloudV2VolumescloneGetInt return &PcloudV2VolumescloneGetInternalServerError{} } -/*PcloudV2VolumescloneGetInternalServerError handles this case with default header values. +/* PcloudV2VolumescloneGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudV2VolumescloneGetInternalServerError struct { func (o *PcloudV2VolumescloneGetInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}][%d] pcloudV2VolumescloneGetInternalServerError %+v", 500, o.Payload) } +func (o *PcloudV2VolumescloneGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumescloneGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_volumes/pcloud_v2_volumesclone_getall_parameters.go b/power/client/p_cloud_volumes/pcloud_v2_volumesclone_getall_parameters.go index 6e231a9a..f18506d0 100644 --- a/power/client/p_cloud_volumes/pcloud_v2_volumesclone_getall_parameters.go +++ b/power/client/p_cloud_volumes/pcloud_v2_volumesclone_getall_parameters.go @@ -13,70 +13,69 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudV2VolumescloneGetallParams creates a new PcloudV2VolumescloneGetallParams object -// with the default values initialized. +// NewPcloudV2VolumescloneGetallParams creates a new PcloudV2VolumescloneGetallParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudV2VolumescloneGetallParams() *PcloudV2VolumescloneGetallParams { - var () return &PcloudV2VolumescloneGetallParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudV2VolumescloneGetallParamsWithTimeout creates a new PcloudV2VolumescloneGetallParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudV2VolumescloneGetallParamsWithTimeout(timeout time.Duration) *PcloudV2VolumescloneGetallParams { - var () return &PcloudV2VolumescloneGetallParams{ - timeout: timeout, } } // NewPcloudV2VolumescloneGetallParamsWithContext creates a new PcloudV2VolumescloneGetallParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudV2VolumescloneGetallParamsWithContext(ctx context.Context) *PcloudV2VolumescloneGetallParams { - var () return &PcloudV2VolumescloneGetallParams{ - Context: ctx, } } // NewPcloudV2VolumescloneGetallParamsWithHTTPClient creates a new PcloudV2VolumescloneGetallParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudV2VolumescloneGetallParamsWithHTTPClient(client *http.Client) *PcloudV2VolumescloneGetallParams { - var () return &PcloudV2VolumescloneGetallParams{ HTTPClient: client, } } -/*PcloudV2VolumescloneGetallParams contains all the parameters to send to the API endpoint -for the pcloud v2 volumesclone getall operation typically these are written to a http.Request +/* PcloudV2VolumescloneGetallParams contains all the parameters to send to the API endpoint + for the pcloud v2 volumesclone getall operation. + + Typically these are written to a http.Request. */ type PcloudV2VolumescloneGetallParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*Filter - volumes-clone filter to limit list items: - prepare - includes status values (preparing, prepared) - start - includes status values (starting, available) - execute - includes status values (executing, available-rollback) - cancel - includes status values (cancelling) - completed - includes status values (completed) - failed - includes status values (failed) - cancelled - includes status values (cancelled) - finalized - included status values (completed, failed, cancelled) + /* Filter. + + volumes-clone filter to limit list items: + prepare - includes status values (preparing, prepared) + start - includes status values (starting, available) + execute - includes status values (executing, available-rollback) + cancel - includes status values (cancelling) + completed - includes status values (completed) + failed - includes status values (failed) + cancelled - includes status values (cancelled) + finalized - included status values (completed, failed, cancelled) */ Filter *string @@ -86,6 +85,21 @@ type PcloudV2VolumescloneGetallParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud v2 volumesclone getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumescloneGetallParams) WithDefaults() *PcloudV2VolumescloneGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v2 volumesclone getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumescloneGetallParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud v2 volumesclone getall params func (o *PcloudV2VolumescloneGetallParams) WithTimeout(timeout time.Duration) *PcloudV2VolumescloneGetallParams { o.SetTimeout(timeout) @@ -158,16 +172,17 @@ func (o *PcloudV2VolumescloneGetallParams) WriteToRequest(r runtime.ClientReques // query param filter var qrFilter string + if o.Filter != nil { qrFilter = *o.Filter } qFilter := qrFilter if qFilter != "" { + if err := r.SetQueryParam("filter", qFilter); err != nil { return err } } - } if len(res) > 0 { diff --git a/power/client/p_cloud_volumes/pcloud_v2_volumesclone_getall_responses.go b/power/client/p_cloud_volumes/pcloud_v2_volumesclone_getall_responses.go index e641fecd..ed1b6660 100644 --- a/power/client/p_cloud_volumes/pcloud_v2_volumesclone_getall_responses.go +++ b/power/client/p_cloud_volumes/pcloud_v2_volumesclone_getall_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudV2VolumescloneGetallReader is a Reader for the PcloudV2VolumescloneGetall structure. @@ -24,44 +23,38 @@ type PcloudV2VolumescloneGetallReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudV2VolumescloneGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudV2VolumescloneGetallOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudV2VolumescloneGetallBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudV2VolumescloneGetallUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudV2VolumescloneGetallNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudV2VolumescloneGetallInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudV2VolumescloneGetallOK() *PcloudV2VolumescloneGetallOK { return &PcloudV2VolumescloneGetallOK{} } -/*PcloudV2VolumescloneGetallOK handles this case with default header values. +/* PcloudV2VolumescloneGetallOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudV2VolumescloneGetallOK struct { func (o *PcloudV2VolumescloneGetallOK) Error() string { return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone][%d] pcloudV2VolumescloneGetallOK %+v", 200, o.Payload) } +func (o *PcloudV2VolumescloneGetallOK) GetPayload() *models.VolumesClones { + return o.Payload +} func (o *PcloudV2VolumescloneGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudV2VolumescloneGetallBadRequest() *PcloudV2VolumescloneGetallBadReq return &PcloudV2VolumescloneGetallBadRequest{} } -/*PcloudV2VolumescloneGetallBadRequest handles this case with default header values. +/* PcloudV2VolumescloneGetallBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudV2VolumescloneGetallBadRequest struct { func (o *PcloudV2VolumescloneGetallBadRequest) Error() string { return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone][%d] pcloudV2VolumescloneGetallBadRequest %+v", 400, o.Payload) } +func (o *PcloudV2VolumescloneGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumescloneGetallBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudV2VolumescloneGetallUnauthorized() *PcloudV2VolumescloneGetallUnau return &PcloudV2VolumescloneGetallUnauthorized{} } -/*PcloudV2VolumescloneGetallUnauthorized handles this case with default header values. +/* PcloudV2VolumescloneGetallUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudV2VolumescloneGetallUnauthorized struct { func (o *PcloudV2VolumescloneGetallUnauthorized) Error() string { return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone][%d] pcloudV2VolumescloneGetallUnauthorized %+v", 401, o.Payload) } +func (o *PcloudV2VolumescloneGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumescloneGetallUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudV2VolumescloneGetallNotFound() *PcloudV2VolumescloneGetallNotFound return &PcloudV2VolumescloneGetallNotFound{} } -/*PcloudV2VolumescloneGetallNotFound handles this case with default header values. +/* PcloudV2VolumescloneGetallNotFound describes a response with status code 404, with default header values. Not Found */ @@ -168,6 +170,9 @@ type PcloudV2VolumescloneGetallNotFound struct { func (o *PcloudV2VolumescloneGetallNotFound) Error() string { return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone][%d] pcloudV2VolumescloneGetallNotFound %+v", 404, o.Payload) } +func (o *PcloudV2VolumescloneGetallNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumescloneGetallNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudV2VolumescloneGetallInternalServerError() *PcloudV2VolumescloneGet return &PcloudV2VolumescloneGetallInternalServerError{} } -/*PcloudV2VolumescloneGetallInternalServerError handles this case with default header values. +/* PcloudV2VolumescloneGetallInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudV2VolumescloneGetallInternalServerError struct { func (o *PcloudV2VolumescloneGetallInternalServerError) Error() string { return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone][%d] pcloudV2VolumescloneGetallInternalServerError %+v", 500, o.Payload) } +func (o *PcloudV2VolumescloneGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumescloneGetallInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_volumes/pcloud_v2_volumesclone_post_parameters.go b/power/client/p_cloud_volumes/pcloud_v2_volumesclone_post_parameters.go index 46423f79..f728df4e 100644 --- a/power/client/p_cloud_volumes/pcloud_v2_volumesclone_post_parameters.go +++ b/power/client/p_cloud_volumes/pcloud_v2_volumesclone_post_parameters.go @@ -13,64 +13,63 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudV2VolumesclonePostParams creates a new PcloudV2VolumesclonePostParams object -// with the default values initialized. +// NewPcloudV2VolumesclonePostParams creates a new PcloudV2VolumesclonePostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudV2VolumesclonePostParams() *PcloudV2VolumesclonePostParams { - var () return &PcloudV2VolumesclonePostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudV2VolumesclonePostParamsWithTimeout creates a new PcloudV2VolumesclonePostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudV2VolumesclonePostParamsWithTimeout(timeout time.Duration) *PcloudV2VolumesclonePostParams { - var () return &PcloudV2VolumesclonePostParams{ - timeout: timeout, } } // NewPcloudV2VolumesclonePostParamsWithContext creates a new PcloudV2VolumesclonePostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudV2VolumesclonePostParamsWithContext(ctx context.Context) *PcloudV2VolumesclonePostParams { - var () return &PcloudV2VolumesclonePostParams{ - Context: ctx, } } // NewPcloudV2VolumesclonePostParamsWithHTTPClient creates a new PcloudV2VolumesclonePostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudV2VolumesclonePostParamsWithHTTPClient(client *http.Client) *PcloudV2VolumesclonePostParams { - var () return &PcloudV2VolumesclonePostParams{ HTTPClient: client, } } -/*PcloudV2VolumesclonePostParams contains all the parameters to send to the API endpoint -for the pcloud v2 volumesclone post operation typically these are written to a http.Request +/* PcloudV2VolumesclonePostParams contains all the parameters to send to the API endpoint + for the pcloud v2 volumesclone post operation. + + Typically these are written to a http.Request. */ type PcloudV2VolumesclonePostParams struct { - /*Body - Parameters for preparing a set of volumes to be cloned + /* Body. + Parameters for preparing a set of volumes to be cloned */ Body *models.VolumesCloneCreate - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -79,6 +78,21 @@ type PcloudV2VolumesclonePostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud v2 volumesclone post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumesclonePostParams) WithDefaults() *PcloudV2VolumesclonePostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v2 volumesclone post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumesclonePostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud v2 volumesclone post params func (o *PcloudV2VolumesclonePostParams) WithTimeout(timeout time.Duration) *PcloudV2VolumesclonePostParams { o.SetTimeout(timeout) @@ -141,7 +155,6 @@ func (o *PcloudV2VolumesclonePostParams) WriteToRequest(r runtime.ClientRequest, return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_volumes/pcloud_v2_volumesclone_post_responses.go b/power/client/p_cloud_volumes/pcloud_v2_volumesclone_post_responses.go index 027b2c16..6caa458f 100644 --- a/power/client/p_cloud_volumes/pcloud_v2_volumesclone_post_responses.go +++ b/power/client/p_cloud_volumes/pcloud_v2_volumesclone_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudV2VolumesclonePostReader is a Reader for the PcloudV2VolumesclonePost structure. @@ -24,51 +23,44 @@ type PcloudV2VolumesclonePostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudV2VolumesclonePostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 202: result := NewPcloudV2VolumesclonePostAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudV2VolumesclonePostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudV2VolumesclonePostUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 403: result := NewPcloudV2VolumesclonePostForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudV2VolumesclonePostNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudV2VolumesclonePostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -77,7 +69,7 @@ func NewPcloudV2VolumesclonePostAccepted() *PcloudV2VolumesclonePostAccepted { return &PcloudV2VolumesclonePostAccepted{} } -/*PcloudV2VolumesclonePostAccepted handles this case with default header values. +/* PcloudV2VolumesclonePostAccepted describes a response with status code 202, with default header values. Accepted */ @@ -88,6 +80,9 @@ type PcloudV2VolumesclonePostAccepted struct { func (o *PcloudV2VolumesclonePostAccepted) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone][%d] pcloudV2VolumesclonePostAccepted %+v", 202, o.Payload) } +func (o *PcloudV2VolumesclonePostAccepted) GetPayload() *models.VolumesClone { + return o.Payload +} func (o *PcloudV2VolumesclonePostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -106,7 +101,7 @@ func NewPcloudV2VolumesclonePostBadRequest() *PcloudV2VolumesclonePostBadRequest return &PcloudV2VolumesclonePostBadRequest{} } -/*PcloudV2VolumesclonePostBadRequest handles this case with default header values. +/* PcloudV2VolumesclonePostBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -117,6 +112,9 @@ type PcloudV2VolumesclonePostBadRequest struct { func (o *PcloudV2VolumesclonePostBadRequest) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone][%d] pcloudV2VolumesclonePostBadRequest %+v", 400, o.Payload) } +func (o *PcloudV2VolumesclonePostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumesclonePostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -135,7 +133,7 @@ func NewPcloudV2VolumesclonePostUnauthorized() *PcloudV2VolumesclonePostUnauthor return &PcloudV2VolumesclonePostUnauthorized{} } -/*PcloudV2VolumesclonePostUnauthorized handles this case with default header values. +/* PcloudV2VolumesclonePostUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -146,6 +144,9 @@ type PcloudV2VolumesclonePostUnauthorized struct { func (o *PcloudV2VolumesclonePostUnauthorized) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone][%d] pcloudV2VolumesclonePostUnauthorized %+v", 401, o.Payload) } +func (o *PcloudV2VolumesclonePostUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumesclonePostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -164,7 +165,7 @@ func NewPcloudV2VolumesclonePostForbidden() *PcloudV2VolumesclonePostForbidden { return &PcloudV2VolumesclonePostForbidden{} } -/*PcloudV2VolumesclonePostForbidden handles this case with default header values. +/* PcloudV2VolumesclonePostForbidden describes a response with status code 403, with default header values. Forbidden */ @@ -175,6 +176,9 @@ type PcloudV2VolumesclonePostForbidden struct { func (o *PcloudV2VolumesclonePostForbidden) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone][%d] pcloudV2VolumesclonePostForbidden %+v", 403, o.Payload) } +func (o *PcloudV2VolumesclonePostForbidden) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumesclonePostForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -193,7 +197,7 @@ func NewPcloudV2VolumesclonePostNotFound() *PcloudV2VolumesclonePostNotFound { return &PcloudV2VolumesclonePostNotFound{} } -/*PcloudV2VolumesclonePostNotFound handles this case with default header values. +/* PcloudV2VolumesclonePostNotFound describes a response with status code 404, with default header values. Not Found */ @@ -204,6 +208,9 @@ type PcloudV2VolumesclonePostNotFound struct { func (o *PcloudV2VolumesclonePostNotFound) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone][%d] pcloudV2VolumesclonePostNotFound %+v", 404, o.Payload) } +func (o *PcloudV2VolumesclonePostNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumesclonePostNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -222,7 +229,7 @@ func NewPcloudV2VolumesclonePostInternalServerError() *PcloudV2VolumesclonePostI return &PcloudV2VolumesclonePostInternalServerError{} } -/*PcloudV2VolumesclonePostInternalServerError handles this case with default header values. +/* PcloudV2VolumesclonePostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -233,6 +240,9 @@ type PcloudV2VolumesclonePostInternalServerError struct { func (o *PcloudV2VolumesclonePostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone][%d] pcloudV2VolumesclonePostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudV2VolumesclonePostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumesclonePostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_volumes/pcloud_v2_volumesclone_start_post_parameters.go b/power/client/p_cloud_volumes/pcloud_v2_volumesclone_start_post_parameters.go index 240393ba..86e9c246 100644 --- a/power/client/p_cloud_volumes/pcloud_v2_volumesclone_start_post_parameters.go +++ b/power/client/p_cloud_volumes/pcloud_v2_volumesclone_start_post_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewPcloudV2VolumescloneStartPostParams creates a new PcloudV2VolumescloneStartPostParams object -// with the default values initialized. +// NewPcloudV2VolumescloneStartPostParams creates a new PcloudV2VolumescloneStartPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudV2VolumescloneStartPostParams() *PcloudV2VolumescloneStartPostParams { - var () return &PcloudV2VolumescloneStartPostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudV2VolumescloneStartPostParamsWithTimeout creates a new PcloudV2VolumescloneStartPostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudV2VolumescloneStartPostParamsWithTimeout(timeout time.Duration) *PcloudV2VolumescloneStartPostParams { - var () return &PcloudV2VolumescloneStartPostParams{ - timeout: timeout, } } // NewPcloudV2VolumescloneStartPostParamsWithContext creates a new PcloudV2VolumescloneStartPostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudV2VolumescloneStartPostParamsWithContext(ctx context.Context) *PcloudV2VolumescloneStartPostParams { - var () return &PcloudV2VolumescloneStartPostParams{ - Context: ctx, } } // NewPcloudV2VolumescloneStartPostParamsWithHTTPClient creates a new PcloudV2VolumescloneStartPostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudV2VolumescloneStartPostParamsWithHTTPClient(client *http.Client) *PcloudV2VolumescloneStartPostParams { - var () return &PcloudV2VolumescloneStartPostParams{ HTTPClient: client, } } -/*PcloudV2VolumescloneStartPostParams contains all the parameters to send to the API endpoint -for the pcloud v2 volumesclone start post operation typically these are written to a http.Request +/* PcloudV2VolumescloneStartPostParams contains all the parameters to send to the API endpoint + for the pcloud v2 volumesclone start post operation. + + Typically these are written to a http.Request. */ type PcloudV2VolumescloneStartPostParams struct { - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string - /*VolumesCloneID - Volumes Clone ID + /* VolumesCloneID. + + Volumes Clone ID */ VolumesCloneID string @@ -77,6 +76,21 @@ type PcloudV2VolumescloneStartPostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud v2 volumesclone start post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumescloneStartPostParams) WithDefaults() *PcloudV2VolumescloneStartPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v2 volumesclone start post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumescloneStartPostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud v2 volumesclone start post params func (o *PcloudV2VolumescloneStartPostParams) WithTimeout(timeout time.Duration) *PcloudV2VolumescloneStartPostParams { o.SetTimeout(timeout) diff --git a/power/client/p_cloud_volumes/pcloud_v2_volumesclone_start_post_responses.go b/power/client/p_cloud_volumes/pcloud_v2_volumesclone_start_post_responses.go index 3024d07f..a144d63d 100644 --- a/power/client/p_cloud_volumes/pcloud_v2_volumesclone_start_post_responses.go +++ b/power/client/p_cloud_volumes/pcloud_v2_volumesclone_start_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudV2VolumescloneStartPostReader is a Reader for the PcloudV2VolumescloneStartPost structure. @@ -24,37 +23,32 @@ type PcloudV2VolumescloneStartPostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudV2VolumescloneStartPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudV2VolumescloneStartPostOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 401: result := NewPcloudV2VolumescloneStartPostUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewPcloudV2VolumescloneStartPostNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudV2VolumescloneStartPostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -63,7 +57,7 @@ func NewPcloudV2VolumescloneStartPostOK() *PcloudV2VolumescloneStartPostOK { return &PcloudV2VolumescloneStartPostOK{} } -/*PcloudV2VolumescloneStartPostOK handles this case with default header values. +/* PcloudV2VolumescloneStartPostOK describes a response with status code 200, with default header values. OK */ @@ -74,6 +68,9 @@ type PcloudV2VolumescloneStartPostOK struct { func (o *PcloudV2VolumescloneStartPostOK) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}/start][%d] pcloudV2VolumescloneStartPostOK %+v", 200, o.Payload) } +func (o *PcloudV2VolumescloneStartPostOK) GetPayload() *models.VolumesClone { + return o.Payload +} func (o *PcloudV2VolumescloneStartPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -92,7 +89,7 @@ func NewPcloudV2VolumescloneStartPostUnauthorized() *PcloudV2VolumescloneStartPo return &PcloudV2VolumescloneStartPostUnauthorized{} } -/*PcloudV2VolumescloneStartPostUnauthorized handles this case with default header values. +/* PcloudV2VolumescloneStartPostUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -103,6 +100,9 @@ type PcloudV2VolumescloneStartPostUnauthorized struct { func (o *PcloudV2VolumescloneStartPostUnauthorized) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}/start][%d] pcloudV2VolumescloneStartPostUnauthorized %+v", 401, o.Payload) } +func (o *PcloudV2VolumescloneStartPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumescloneStartPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -121,7 +121,7 @@ func NewPcloudV2VolumescloneStartPostNotFound() *PcloudV2VolumescloneStartPostNo return &PcloudV2VolumescloneStartPostNotFound{} } -/*PcloudV2VolumescloneStartPostNotFound handles this case with default header values. +/* PcloudV2VolumescloneStartPostNotFound describes a response with status code 404, with default header values. Not Found */ @@ -132,6 +132,9 @@ type PcloudV2VolumescloneStartPostNotFound struct { func (o *PcloudV2VolumescloneStartPostNotFound) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}/start][%d] pcloudV2VolumescloneStartPostNotFound %+v", 404, o.Payload) } +func (o *PcloudV2VolumescloneStartPostNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumescloneStartPostNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -150,7 +153,7 @@ func NewPcloudV2VolumescloneStartPostInternalServerError() *PcloudV2Volumesclone return &PcloudV2VolumescloneStartPostInternalServerError{} } -/*PcloudV2VolumescloneStartPostInternalServerError handles this case with default header values. +/* PcloudV2VolumescloneStartPostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -161,6 +164,9 @@ type PcloudV2VolumescloneStartPostInternalServerError struct { func (o *PcloudV2VolumescloneStartPostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}/start][%d] pcloudV2VolumescloneStartPostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudV2VolumescloneStartPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudV2VolumescloneStartPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/p_cloud_volumes/pcloud_volumes_clone_post_parameters.go b/power/client/p_cloud_volumes/pcloud_volumes_clone_post_parameters.go index 7aba8116..44e22ad1 100644 --- a/power/client/p_cloud_volumes/pcloud_volumes_clone_post_parameters.go +++ b/power/client/p_cloud_volumes/pcloud_volumes_clone_post_parameters.go @@ -13,64 +13,63 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewPcloudVolumesClonePostParams creates a new PcloudVolumesClonePostParams object -// with the default values initialized. +// NewPcloudVolumesClonePostParams creates a new PcloudVolumesClonePostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPcloudVolumesClonePostParams() *PcloudVolumesClonePostParams { - var () return &PcloudVolumesClonePostParams{ - timeout: cr.DefaultTimeout, } } // NewPcloudVolumesClonePostParamsWithTimeout creates a new PcloudVolumesClonePostParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPcloudVolumesClonePostParamsWithTimeout(timeout time.Duration) *PcloudVolumesClonePostParams { - var () return &PcloudVolumesClonePostParams{ - timeout: timeout, } } // NewPcloudVolumesClonePostParamsWithContext creates a new PcloudVolumesClonePostParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPcloudVolumesClonePostParamsWithContext(ctx context.Context) *PcloudVolumesClonePostParams { - var () return &PcloudVolumesClonePostParams{ - Context: ctx, } } // NewPcloudVolumesClonePostParamsWithHTTPClient creates a new PcloudVolumesClonePostParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPcloudVolumesClonePostParamsWithHTTPClient(client *http.Client) *PcloudVolumesClonePostParams { - var () return &PcloudVolumesClonePostParams{ HTTPClient: client, } } -/*PcloudVolumesClonePostParams contains all the parameters to send to the API endpoint -for the pcloud volumes clone post operation typically these are written to a http.Request +/* PcloudVolumesClonePostParams contains all the parameters to send to the API endpoint + for the pcloud volumes clone post operation. + + Typically these are written to a http.Request. */ type PcloudVolumesClonePostParams struct { - /*Body - Parameters for the cloning of volumes + /* Body. + Parameters for the cloning of volumes */ Body *models.VolumesCloneRequest - /*CloudInstanceID - Cloud Instance ID of a PCloud Instance + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance */ CloudInstanceID string @@ -79,6 +78,21 @@ type PcloudVolumesClonePostParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the pcloud volumes clone post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVolumesClonePostParams) WithDefaults() *PcloudVolumesClonePostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud volumes clone post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVolumesClonePostParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the pcloud volumes clone post params func (o *PcloudVolumesClonePostParams) WithTimeout(timeout time.Duration) *PcloudVolumesClonePostParams { o.SetTimeout(timeout) @@ -141,7 +155,6 @@ func (o *PcloudVolumesClonePostParams) WriteToRequest(r runtime.ClientRequest, r return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/p_cloud_volumes/pcloud_volumes_clone_post_responses.go b/power/client/p_cloud_volumes/pcloud_volumes_clone_post_responses.go index 261be98d..5c13855d 100644 --- a/power/client/p_cloud_volumes/pcloud_volumes_clone_post_responses.go +++ b/power/client/p_cloud_volumes/pcloud_volumes_clone_post_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // PcloudVolumesClonePostReader is a Reader for the PcloudVolumesClonePost structure. @@ -24,44 +23,38 @@ type PcloudVolumesClonePostReader struct { // ReadResponse reads a server response into the received o. func (o *PcloudVolumesClonePostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPcloudVolumesClonePostOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPcloudVolumesClonePostBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 401: result := NewPcloudVolumesClonePostUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 409: result := NewPcloudVolumesClonePostConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 500: result := NewPcloudVolumesClonePostInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewPcloudVolumesClonePostOK() *PcloudVolumesClonePostOK { return &PcloudVolumesClonePostOK{} } -/*PcloudVolumesClonePostOK handles this case with default header values. +/* PcloudVolumesClonePostOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type PcloudVolumesClonePostOK struct { func (o *PcloudVolumesClonePostOK) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/clone][%d] pcloudVolumesClonePostOK %+v", 200, o.Payload) } +func (o *PcloudVolumesClonePostOK) GetPayload() *models.VolumesCloneResponse { + return o.Payload +} func (o *PcloudVolumesClonePostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -99,7 +95,7 @@ func NewPcloudVolumesClonePostBadRequest() *PcloudVolumesClonePostBadRequest { return &PcloudVolumesClonePostBadRequest{} } -/*PcloudVolumesClonePostBadRequest handles this case with default header values. +/* PcloudVolumesClonePostBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -110,6 +106,9 @@ type PcloudVolumesClonePostBadRequest struct { func (o *PcloudVolumesClonePostBadRequest) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/clone][%d] pcloudVolumesClonePostBadRequest %+v", 400, o.Payload) } +func (o *PcloudVolumesClonePostBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVolumesClonePostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -128,7 +127,7 @@ func NewPcloudVolumesClonePostUnauthorized() *PcloudVolumesClonePostUnauthorized return &PcloudVolumesClonePostUnauthorized{} } -/*PcloudVolumesClonePostUnauthorized handles this case with default header values. +/* PcloudVolumesClonePostUnauthorized describes a response with status code 401, with default header values. Unauthorized */ @@ -139,6 +138,9 @@ type PcloudVolumesClonePostUnauthorized struct { func (o *PcloudVolumesClonePostUnauthorized) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/clone][%d] pcloudVolumesClonePostUnauthorized %+v", 401, o.Payload) } +func (o *PcloudVolumesClonePostUnauthorized) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVolumesClonePostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -157,7 +159,7 @@ func NewPcloudVolumesClonePostConflict() *PcloudVolumesClonePostConflict { return &PcloudVolumesClonePostConflict{} } -/*PcloudVolumesClonePostConflict handles this case with default header values. +/* PcloudVolumesClonePostConflict describes a response with status code 409, with default header values. Conflict */ @@ -168,6 +170,9 @@ type PcloudVolumesClonePostConflict struct { func (o *PcloudVolumesClonePostConflict) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/clone][%d] pcloudVolumesClonePostConflict %+v", 409, o.Payload) } +func (o *PcloudVolumesClonePostConflict) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVolumesClonePostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -186,7 +191,7 @@ func NewPcloudVolumesClonePostInternalServerError() *PcloudVolumesClonePostInter return &PcloudVolumesClonePostInternalServerError{} } -/*PcloudVolumesClonePostInternalServerError handles this case with default header values. +/* PcloudVolumesClonePostInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -197,6 +202,9 @@ type PcloudVolumesClonePostInternalServerError struct { func (o *PcloudVolumesClonePostInternalServerError) Error() string { return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/clone][%d] pcloudVolumesClonePostInternalServerError %+v", 500, o.Payload) } +func (o *PcloudVolumesClonePostInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *PcloudVolumesClonePostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/power_iaas_client.go b/power/client/power_iaas_api_client.go similarity index 74% rename from power/client/power_iaas_client.go rename to power/client/power_iaas_api_client.go index 0a98eb31..749813a1 100644 --- a/power/client/power_iaas_client.go +++ b/power/client/power_iaas_api_client.go @@ -8,8 +8,7 @@ package client import ( "github.com/go-openapi/runtime" httptransport "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" "github.com/IBM-Cloud/power-go-client/power/client/authentication" "github.com/IBM-Cloud/power-go-client/power/client/bluemix_service_instances" @@ -43,7 +42,7 @@ import ( "github.com/IBM-Cloud/power-go-client/power/client/swagger_spec" ) -// Default power iaas HTTP client. +// Default power iaas API HTTP client. var Default = NewHTTPClient(nil) const ( @@ -58,14 +57,14 @@ const ( // DefaultSchemes are the default schemes found in Meta (info) section of spec file var DefaultSchemes = []string{"http"} -// NewHTTPClient creates a new power iaas HTTP client. -func NewHTTPClient(formats strfmt.Registry) *PowerIaas { +// NewHTTPClient creates a new power iaas API HTTP client. +func NewHTTPClient(formats strfmt.Registry) *PowerIaasAPI { return NewHTTPClientWithConfig(formats, nil) } -// NewHTTPClientWithConfig creates a new power iaas HTTP client, +// NewHTTPClientWithConfig creates a new power iaas API HTTP client, // using a customizable transport config. -func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *PowerIaas { +func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *PowerIaasAPI { // ensure nullable parameters have default if cfg == nil { cfg = DefaultTransportConfig() @@ -76,76 +75,45 @@ func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *Pow return New(transport, formats) } -// New creates a new power iaas client -func New(transport runtime.ClientTransport, formats strfmt.Registry) *PowerIaas { +// New creates a new power iaas API client +func New(transport runtime.ClientTransport, formats strfmt.Registry) *PowerIaasAPI { // ensure nullable parameters have default if formats == nil { formats = strfmt.Default } - cli := new(PowerIaas) + cli := new(PowerIaasAPI) cli.Transport = transport - cli.Authentication = authentication.New(transport, formats) - cli.BluemixServiceInstances = bluemix_service_instances.New(transport, formats) - cli.Catalog = catalog.New(transport, formats) - cli.HardwarePlatforms = hardware_platforms.New(transport, formats) - cli.IaasServiceBroker = iaas_service_broker.New(transport, formats) - cli.InternalStorageRegions = internal_storage_regions.New(transport, formats) - cli.OpenStacks = open_stacks.New(transport, formats) - cli.PCloudCloudConnections = p_cloud_cloud_connections.New(transport, formats) - cli.PCloudEvents = p_cloud_events.New(transport, formats) - cli.PCloudImages = p_cloud_images.New(transport, formats) - cli.PCloudInstances = p_cloud_instances.New(transport, formats) - cli.PCloudJobs = p_cloud_jobs.New(transport, formats) - cli.PCloudNetworks = p_cloud_networks.New(transport, formats) - - cli.PCloudPVMInstances = p_cloud_p_vm_instances.New(transport, formats) - + cli.PCloudpVMInstances = p_cloud_p_vm_instances.New(transport, formats) cli.PCloudPlacementGroups = p_cloud_placement_groups.New(transport, formats) - - cli.PCloudSAP = p_cloud_s_a_p.New(transport, formats) - - cli.PCloudServiceDHCP = p_cloud_service_d_h_c_p.New(transport, formats) - + cli.PCloudsap = p_cloud_s_a_p.New(transport, formats) + cli.PCloudServicedhcp = p_cloud_service_d_h_c_p.New(transport, formats) cli.PCloudSnapshots = p_cloud_snapshots.New(transport, formats) - cli.PCloudStorageCapacity = p_cloud_storage_capacity.New(transport, formats) - cli.PCloudSystemPools = p_cloud_system_pools.New(transport, formats) - cli.PCloudTasks = p_cloud_tasks.New(transport, formats) - cli.PCloudTenants = p_cloud_tenants.New(transport, formats) - cli.PCloudTenantsSSHKeys = p_cloud_tenants_ssh_keys.New(transport, formats) - - cli.PCloudVPNConnections = p_cloud_v_p_n_connections.New(transport, formats) - - cli.PCloudVPNPolicies = p_cloud_v_p_n_policies.New(transport, formats) - + cli.PCloudvpnConnections = p_cloud_v_p_n_connections.New(transport, formats) + cli.PCloudvpnPolicies = p_cloud_v_p_n_policies.New(transport, formats) cli.PCloudVolumes = p_cloud_volumes.New(transport, formats) - cli.ServiceBindings = service_bindings.New(transport, formats) - cli.ServiceInstances = service_instances.New(transport, formats) - cli.StorageTypes = storage_types.New(transport, formats) - cli.SwaggerSpec = swagger_spec.New(transport, formats) - return cli } @@ -188,133 +156,102 @@ func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig { return cfg } -// PowerIaas is a client for power iaas -type PowerIaas struct { - Authentication *authentication.Client +// PowerIaasAPI is a client for power iaas API +type PowerIaasAPI struct { + Authentication authentication.ClientService - BluemixServiceInstances *bluemix_service_instances.Client + BluemixServiceInstances bluemix_service_instances.ClientService - Catalog *catalog.Client + Catalog catalog.ClientService - HardwarePlatforms *hardware_platforms.Client + HardwarePlatforms hardware_platforms.ClientService - IaasServiceBroker *iaas_service_broker.Client + IaasServiceBroker iaas_service_broker.ClientService - InternalStorageRegions *internal_storage_regions.Client + InternalStorageRegions internal_storage_regions.ClientService - OpenStacks *open_stacks.Client + OpenStacks open_stacks.ClientService - PCloudCloudConnections *p_cloud_cloud_connections.Client + PCloudCloudConnections p_cloud_cloud_connections.ClientService - PCloudEvents *p_cloud_events.Client + PCloudEvents p_cloud_events.ClientService - PCloudImages *p_cloud_images.Client + PCloudImages p_cloud_images.ClientService - PCloudInstances *p_cloud_instances.Client + PCloudInstances p_cloud_instances.ClientService - PCloudJobs *p_cloud_jobs.Client + PCloudJobs p_cloud_jobs.ClientService - PCloudNetworks *p_cloud_networks.Client + PCloudNetworks p_cloud_networks.ClientService - PCloudPVMInstances *p_cloud_p_vm_instances.Client + PCloudpVMInstances p_cloud_p_vm_instances.ClientService - PCloudPlacementGroups *p_cloud_placement_groups.Client + PCloudPlacementGroups p_cloud_placement_groups.ClientService - PCloudSAP *p_cloud_s_a_p.Client + PCloudsap p_cloud_s_a_p.ClientService - PCloudServiceDHCP *p_cloud_service_d_h_c_p.Client + PCloudServicedhcp p_cloud_service_d_h_c_p.ClientService - PCloudSnapshots *p_cloud_snapshots.Client + PCloudSnapshots p_cloud_snapshots.ClientService - PCloudStorageCapacity *p_cloud_storage_capacity.Client + PCloudStorageCapacity p_cloud_storage_capacity.ClientService - PCloudSystemPools *p_cloud_system_pools.Client + PCloudSystemPools p_cloud_system_pools.ClientService - PCloudTasks *p_cloud_tasks.Client + PCloudTasks p_cloud_tasks.ClientService - PCloudTenants *p_cloud_tenants.Client + PCloudTenants p_cloud_tenants.ClientService - PCloudTenantsSSHKeys *p_cloud_tenants_ssh_keys.Client + PCloudTenantsSSHKeys p_cloud_tenants_ssh_keys.ClientService - PCloudVPNConnections *p_cloud_v_p_n_connections.Client + PCloudvpnConnections p_cloud_v_p_n_connections.ClientService - PCloudVPNPolicies *p_cloud_v_p_n_policies.Client + PCloudvpnPolicies p_cloud_v_p_n_policies.ClientService - PCloudVolumes *p_cloud_volumes.Client + PCloudVolumes p_cloud_volumes.ClientService - ServiceBindings *service_bindings.Client + ServiceBindings service_bindings.ClientService - ServiceInstances *service_instances.Client + ServiceInstances service_instances.ClientService - StorageTypes *storage_types.Client + StorageTypes storage_types.ClientService - SwaggerSpec *swagger_spec.Client + SwaggerSpec swagger_spec.ClientService Transport runtime.ClientTransport } // SetTransport changes the transport on the client and all its subresources -func (c *PowerIaas) SetTransport(transport runtime.ClientTransport) { +func (c *PowerIaasAPI) SetTransport(transport runtime.ClientTransport) { c.Transport = transport - c.Authentication.SetTransport(transport) - c.BluemixServiceInstances.SetTransport(transport) - c.Catalog.SetTransport(transport) - c.HardwarePlatforms.SetTransport(transport) - c.IaasServiceBroker.SetTransport(transport) - c.InternalStorageRegions.SetTransport(transport) - c.OpenStacks.SetTransport(transport) - c.PCloudCloudConnections.SetTransport(transport) - c.PCloudEvents.SetTransport(transport) - c.PCloudImages.SetTransport(transport) - c.PCloudInstances.SetTransport(transport) - c.PCloudJobs.SetTransport(transport) - c.PCloudNetworks.SetTransport(transport) - - c.PCloudPVMInstances.SetTransport(transport) - + c.PCloudpVMInstances.SetTransport(transport) c.PCloudPlacementGroups.SetTransport(transport) - - c.PCloudSAP.SetTransport(transport) - - c.PCloudServiceDHCP.SetTransport(transport) - + c.PCloudsap.SetTransport(transport) + c.PCloudServicedhcp.SetTransport(transport) c.PCloudSnapshots.SetTransport(transport) - c.PCloudStorageCapacity.SetTransport(transport) - c.PCloudSystemPools.SetTransport(transport) - c.PCloudTasks.SetTransport(transport) - c.PCloudTenants.SetTransport(transport) - c.PCloudTenantsSSHKeys.SetTransport(transport) - - c.PCloudVPNConnections.SetTransport(transport) - - c.PCloudVPNPolicies.SetTransport(transport) - + c.PCloudvpnConnections.SetTransport(transport) + c.PCloudvpnPolicies.SetTransport(transport) c.PCloudVolumes.SetTransport(transport) - c.ServiceBindings.SetTransport(transport) - c.ServiceInstances.SetTransport(transport) - c.StorageTypes.SetTransport(transport) - c.SwaggerSpec.SetTransport(transport) - } diff --git a/power/client/service_bindings/service_binding_binding_parameters.go b/power/client/service_bindings/service_binding_binding_parameters.go index cb170e49..e2a1fc91 100644 --- a/power/client/service_bindings/service_binding_binding_parameters.go +++ b/power/client/service_bindings/service_binding_binding_parameters.go @@ -13,85 +13,88 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewServiceBindingBindingParams creates a new ServiceBindingBindingParams object -// with the default values initialized. +// NewServiceBindingBindingParams creates a new ServiceBindingBindingParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewServiceBindingBindingParams() *ServiceBindingBindingParams { - var () return &ServiceBindingBindingParams{ - timeout: cr.DefaultTimeout, } } // NewServiceBindingBindingParamsWithTimeout creates a new ServiceBindingBindingParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewServiceBindingBindingParamsWithTimeout(timeout time.Duration) *ServiceBindingBindingParams { - var () return &ServiceBindingBindingParams{ - timeout: timeout, } } // NewServiceBindingBindingParamsWithContext creates a new ServiceBindingBindingParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewServiceBindingBindingParamsWithContext(ctx context.Context) *ServiceBindingBindingParams { - var () return &ServiceBindingBindingParams{ - Context: ctx, } } // NewServiceBindingBindingParamsWithHTTPClient creates a new ServiceBindingBindingParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewServiceBindingBindingParamsWithHTTPClient(client *http.Client) *ServiceBindingBindingParams { - var () return &ServiceBindingBindingParams{ HTTPClient: client, } } -/*ServiceBindingBindingParams contains all the parameters to send to the API endpoint -for the service binding binding operation typically these are written to a http.Request +/* ServiceBindingBindingParams contains all the parameters to send to the API endpoint + for the service binding binding operation. + + Typically these are written to a http.Request. */ type ServiceBindingBindingParams struct { - /*XBrokerAPIOriginatingIdentity - identity of the user that initiated the request from the Platform + /* XBrokerAPIOriginatingIdentity. + identity of the user that initiated the request from the Platform */ XBrokerAPIOriginatingIdentity *string - /*XBrokerAPIVersion - version number of the Service Broker API that the Platform will use + /* XBrokerAPIVersion. + + version number of the Service Broker API that the Platform will use */ XBrokerAPIVersion string - /*AcceptsIncomplete - asynchronous operations supported + /* AcceptsIncomplete. + + asynchronous operations supported */ AcceptsIncomplete *bool - /*BindingID - binding id of binding to create + /* BindingID. + + binding id of binding to create */ BindingID string - /*Body - parameters for the requested service binding + /* Body. + + parameters for the requested service binding */ Body *models.ServiceBindingRequest - /*InstanceID - instance id of instance to provision + /* InstanceID. + + instance id of instance to provision */ InstanceID string @@ -100,6 +103,21 @@ type ServiceBindingBindingParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the service binding binding params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBindingBindingParams) WithDefaults() *ServiceBindingBindingParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service binding binding params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBindingBindingParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the service binding binding params func (o *ServiceBindingBindingParams) WithTimeout(timeout time.Duration) *ServiceBindingBindingParams { o.SetTimeout(timeout) @@ -213,7 +231,6 @@ func (o *ServiceBindingBindingParams) WriteToRequest(r runtime.ClientRequest, re if err := r.SetHeaderParam("X-Broker-API-Originating-Identity", *o.XBrokerAPIOriginatingIdentity); err != nil { return err } - } // header param X-Broker-API-Version @@ -225,23 +242,23 @@ func (o *ServiceBindingBindingParams) WriteToRequest(r runtime.ClientRequest, re // query param accepts_incomplete var qrAcceptsIncomplete bool + if o.AcceptsIncomplete != nil { qrAcceptsIncomplete = *o.AcceptsIncomplete } qAcceptsIncomplete := swag.FormatBool(qrAcceptsIncomplete) if qAcceptsIncomplete != "" { + if err := r.SetQueryParam("accepts_incomplete", qAcceptsIncomplete); err != nil { return err } } - } // path param binding_id if err := r.SetPathParam("binding_id", o.BindingID); err != nil { return err } - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/service_bindings/service_binding_binding_responses.go b/power/client/service_bindings/service_binding_binding_responses.go index 8314fbf8..8d6a348a 100644 --- a/power/client/service_bindings/service_binding_binding_responses.go +++ b/power/client/service_bindings/service_binding_binding_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // ServiceBindingBindingReader is a Reader for the ServiceBindingBinding structure. @@ -24,51 +23,44 @@ type ServiceBindingBindingReader struct { // ReadResponse reads a server response into the received o. func (o *ServiceBindingBindingReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewServiceBindingBindingOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 201: result := NewServiceBindingBindingCreated() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 202: result := NewServiceBindingBindingAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewServiceBindingBindingBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 409: result := NewServiceBindingBindingConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewServiceBindingBindingUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -77,7 +69,7 @@ func NewServiceBindingBindingOK() *ServiceBindingBindingOK { return &ServiceBindingBindingOK{} } -/*ServiceBindingBindingOK handles this case with default header values. +/* ServiceBindingBindingOK describes a response with status code 200, with default header values. OK */ @@ -88,6 +80,9 @@ type ServiceBindingBindingOK struct { func (o *ServiceBindingBindingOK) Error() string { return fmt.Sprintf("[PUT /v2/service_instances/{instance_id}/service_bindings/{binding_id}][%d] serviceBindingBindingOK %+v", 200, o.Payload) } +func (o *ServiceBindingBindingOK) GetPayload() *models.ServiceBinding { + return o.Payload +} func (o *ServiceBindingBindingOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -106,7 +101,7 @@ func NewServiceBindingBindingCreated() *ServiceBindingBindingCreated { return &ServiceBindingBindingCreated{} } -/*ServiceBindingBindingCreated handles this case with default header values. +/* ServiceBindingBindingCreated describes a response with status code 201, with default header values. Created */ @@ -117,6 +112,9 @@ type ServiceBindingBindingCreated struct { func (o *ServiceBindingBindingCreated) Error() string { return fmt.Sprintf("[PUT /v2/service_instances/{instance_id}/service_bindings/{binding_id}][%d] serviceBindingBindingCreated %+v", 201, o.Payload) } +func (o *ServiceBindingBindingCreated) GetPayload() *models.ServiceBinding { + return o.Payload +} func (o *ServiceBindingBindingCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -135,7 +133,7 @@ func NewServiceBindingBindingAccepted() *ServiceBindingBindingAccepted { return &ServiceBindingBindingAccepted{} } -/*ServiceBindingBindingAccepted handles this case with default header values. +/* ServiceBindingBindingAccepted describes a response with status code 202, with default header values. Accepted */ @@ -146,6 +144,9 @@ type ServiceBindingBindingAccepted struct { func (o *ServiceBindingBindingAccepted) Error() string { return fmt.Sprintf("[PUT /v2/service_instances/{instance_id}/service_bindings/{binding_id}][%d] serviceBindingBindingAccepted %+v", 202, o.Payload) } +func (o *ServiceBindingBindingAccepted) GetPayload() *models.AsyncOperation { + return o.Payload +} func (o *ServiceBindingBindingAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -164,7 +165,7 @@ func NewServiceBindingBindingBadRequest() *ServiceBindingBindingBadRequest { return &ServiceBindingBindingBadRequest{} } -/*ServiceBindingBindingBadRequest handles this case with default header values. +/* ServiceBindingBindingBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -175,6 +176,9 @@ type ServiceBindingBindingBadRequest struct { func (o *ServiceBindingBindingBadRequest) Error() string { return fmt.Sprintf("[PUT /v2/service_instances/{instance_id}/service_bindings/{binding_id}][%d] serviceBindingBindingBadRequest %+v", 400, o.Payload) } +func (o *ServiceBindingBindingBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBindingBindingBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -193,7 +197,7 @@ func NewServiceBindingBindingConflict() *ServiceBindingBindingConflict { return &ServiceBindingBindingConflict{} } -/*ServiceBindingBindingConflict handles this case with default header values. +/* ServiceBindingBindingConflict describes a response with status code 409, with default header values. Conflict */ @@ -204,6 +208,9 @@ type ServiceBindingBindingConflict struct { func (o *ServiceBindingBindingConflict) Error() string { return fmt.Sprintf("[PUT /v2/service_instances/{instance_id}/service_bindings/{binding_id}][%d] serviceBindingBindingConflict %+v", 409, o.Payload) } +func (o *ServiceBindingBindingConflict) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBindingBindingConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -222,7 +229,7 @@ func NewServiceBindingBindingUnprocessableEntity() *ServiceBindingBindingUnproce return &ServiceBindingBindingUnprocessableEntity{} } -/*ServiceBindingBindingUnprocessableEntity handles this case with default header values. +/* ServiceBindingBindingUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -233,6 +240,9 @@ type ServiceBindingBindingUnprocessableEntity struct { func (o *ServiceBindingBindingUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /v2/service_instances/{instance_id}/service_bindings/{binding_id}][%d] serviceBindingBindingUnprocessableEntity %+v", 422, o.Payload) } +func (o *ServiceBindingBindingUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBindingBindingUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/service_bindings/service_binding_get_parameters.go b/power/client/service_bindings/service_binding_get_parameters.go index bc7ef772..98450eb6 100644 --- a/power/client/service_bindings/service_binding_get_parameters.go +++ b/power/client/service_bindings/service_binding_get_parameters.go @@ -13,72 +13,73 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewServiceBindingGetParams creates a new ServiceBindingGetParams object -// with the default values initialized. +// NewServiceBindingGetParams creates a new ServiceBindingGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewServiceBindingGetParams() *ServiceBindingGetParams { - var () return &ServiceBindingGetParams{ - timeout: cr.DefaultTimeout, } } // NewServiceBindingGetParamsWithTimeout creates a new ServiceBindingGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewServiceBindingGetParamsWithTimeout(timeout time.Duration) *ServiceBindingGetParams { - var () return &ServiceBindingGetParams{ - timeout: timeout, } } // NewServiceBindingGetParamsWithContext creates a new ServiceBindingGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewServiceBindingGetParamsWithContext(ctx context.Context) *ServiceBindingGetParams { - var () return &ServiceBindingGetParams{ - Context: ctx, } } // NewServiceBindingGetParamsWithHTTPClient creates a new ServiceBindingGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewServiceBindingGetParamsWithHTTPClient(client *http.Client) *ServiceBindingGetParams { - var () return &ServiceBindingGetParams{ HTTPClient: client, } } -/*ServiceBindingGetParams contains all the parameters to send to the API endpoint -for the service binding get operation typically these are written to a http.Request +/* ServiceBindingGetParams contains all the parameters to send to the API endpoint + for the service binding get operation. + + Typically these are written to a http.Request. */ type ServiceBindingGetParams struct { - /*XBrokerAPIOriginatingIdentity - identity of the user that initiated the request from the Platform + /* XBrokerAPIOriginatingIdentity. + identity of the user that initiated the request from the Platform */ XBrokerAPIOriginatingIdentity *string - /*XBrokerAPIVersion - version number of the Service Broker API that the Platform will use + /* XBrokerAPIVersion. + + version number of the Service Broker API that the Platform will use */ XBrokerAPIVersion string - /*BindingID - binding id of binding to create + /* BindingID. + + binding id of binding to create */ BindingID string - /*InstanceID - instance id of instance to provision + /* InstanceID. + + instance id of instance to provision */ InstanceID string @@ -87,6 +88,21 @@ type ServiceBindingGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the service binding get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBindingGetParams) WithDefaults() *ServiceBindingGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service binding get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBindingGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the service binding get params func (o *ServiceBindingGetParams) WithTimeout(timeout time.Duration) *ServiceBindingGetParams { o.SetTimeout(timeout) @@ -178,7 +194,6 @@ func (o *ServiceBindingGetParams) WriteToRequest(r runtime.ClientRequest, reg st if err := r.SetHeaderParam("X-Broker-API-Originating-Identity", *o.XBrokerAPIOriginatingIdentity); err != nil { return err } - } // header param X-Broker-API-Version diff --git a/power/client/service_bindings/service_binding_get_responses.go b/power/client/service_bindings/service_binding_get_responses.go index 61d138e2..ba1f5d08 100644 --- a/power/client/service_bindings/service_binding_get_responses.go +++ b/power/client/service_bindings/service_binding_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // ServiceBindingGetReader is a Reader for the ServiceBindingGet structure. @@ -24,23 +23,20 @@ type ServiceBindingGetReader struct { // ReadResponse reads a server response into the received o. func (o *ServiceBindingGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewServiceBindingGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 404: result := NewServiceBindingGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -49,7 +45,7 @@ func NewServiceBindingGetOK() *ServiceBindingGetOK { return &ServiceBindingGetOK{} } -/*ServiceBindingGetOK handles this case with default header values. +/* ServiceBindingGetOK describes a response with status code 200, with default header values. OK */ @@ -60,6 +56,9 @@ type ServiceBindingGetOK struct { func (o *ServiceBindingGetOK) Error() string { return fmt.Sprintf("[GET /v2/service_instances/{instance_id}/service_bindings/{binding_id}][%d] serviceBindingGetOK %+v", 200, o.Payload) } +func (o *ServiceBindingGetOK) GetPayload() *models.ServiceBindingResource { + return o.Payload +} func (o *ServiceBindingGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -78,7 +77,7 @@ func NewServiceBindingGetNotFound() *ServiceBindingGetNotFound { return &ServiceBindingGetNotFound{} } -/*ServiceBindingGetNotFound handles this case with default header values. +/* ServiceBindingGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -89,6 +88,9 @@ type ServiceBindingGetNotFound struct { func (o *ServiceBindingGetNotFound) Error() string { return fmt.Sprintf("[GET /v2/service_instances/{instance_id}/service_bindings/{binding_id}][%d] serviceBindingGetNotFound %+v", 404, o.Payload) } +func (o *ServiceBindingGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBindingGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/service_bindings/service_binding_last_operation_get_parameters.go b/power/client/service_bindings/service_binding_last_operation_get_parameters.go index 25bba75c..20ee289c 100644 --- a/power/client/service_bindings/service_binding_last_operation_get_parameters.go +++ b/power/client/service_bindings/service_binding_last_operation_get_parameters.go @@ -13,82 +13,85 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewServiceBindingLastOperationGetParams creates a new ServiceBindingLastOperationGetParams object -// with the default values initialized. +// NewServiceBindingLastOperationGetParams creates a new ServiceBindingLastOperationGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewServiceBindingLastOperationGetParams() *ServiceBindingLastOperationGetParams { - var () return &ServiceBindingLastOperationGetParams{ - timeout: cr.DefaultTimeout, } } // NewServiceBindingLastOperationGetParamsWithTimeout creates a new ServiceBindingLastOperationGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewServiceBindingLastOperationGetParamsWithTimeout(timeout time.Duration) *ServiceBindingLastOperationGetParams { - var () return &ServiceBindingLastOperationGetParams{ - timeout: timeout, } } // NewServiceBindingLastOperationGetParamsWithContext creates a new ServiceBindingLastOperationGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewServiceBindingLastOperationGetParamsWithContext(ctx context.Context) *ServiceBindingLastOperationGetParams { - var () return &ServiceBindingLastOperationGetParams{ - Context: ctx, } } // NewServiceBindingLastOperationGetParamsWithHTTPClient creates a new ServiceBindingLastOperationGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewServiceBindingLastOperationGetParamsWithHTTPClient(client *http.Client) *ServiceBindingLastOperationGetParams { - var () return &ServiceBindingLastOperationGetParams{ HTTPClient: client, } } -/*ServiceBindingLastOperationGetParams contains all the parameters to send to the API endpoint -for the service binding last operation get operation typically these are written to a http.Request +/* ServiceBindingLastOperationGetParams contains all the parameters to send to the API endpoint + for the service binding last operation get operation. + + Typically these are written to a http.Request. */ type ServiceBindingLastOperationGetParams struct { - /*XBrokerAPIVersion - version number of the Service Broker API that the Platform will use + /* XBrokerAPIVersion. + version number of the Service Broker API that the Platform will use */ XBrokerAPIVersion string - /*BindingID - binding id of binding to create + /* BindingID. + + binding id of binding to create */ BindingID string - /*InstanceID - instance id of instance to provision + /* InstanceID. + + instance id of instance to provision */ InstanceID string - /*Operation - a provided identifier for the operation + /* Operation. + + a provided identifier for the operation */ Operation *string - /*PlanID - id of the plan associated with the instance + /* PlanID. + + id of the plan associated with the instance */ PlanID *string - /*ServiceID - id of the service associated with the instance + /* ServiceID. + + id of the service associated with the instance */ ServiceID *string @@ -97,6 +100,21 @@ type ServiceBindingLastOperationGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the service binding last operation get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBindingLastOperationGetParams) WithDefaults() *ServiceBindingLastOperationGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service binding last operation get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBindingLastOperationGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the service binding last operation get params func (o *ServiceBindingLastOperationGetParams) WithTimeout(timeout time.Duration) *ServiceBindingLastOperationGetParams { o.SetTimeout(timeout) @@ -223,48 +241,51 @@ func (o *ServiceBindingLastOperationGetParams) WriteToRequest(r runtime.ClientRe // query param operation var qrOperation string + if o.Operation != nil { qrOperation = *o.Operation } qOperation := qrOperation if qOperation != "" { + if err := r.SetQueryParam("operation", qOperation); err != nil { return err } } - } if o.PlanID != nil { // query param plan_id var qrPlanID string + if o.PlanID != nil { qrPlanID = *o.PlanID } qPlanID := qrPlanID if qPlanID != "" { + if err := r.SetQueryParam("plan_id", qPlanID); err != nil { return err } } - } if o.ServiceID != nil { // query param service_id var qrServiceID string + if o.ServiceID != nil { qrServiceID = *o.ServiceID } qServiceID := qrServiceID if qServiceID != "" { + if err := r.SetQueryParam("service_id", qServiceID); err != nil { return err } } - } if len(res) > 0 { diff --git a/power/client/service_bindings/service_binding_last_operation_get_responses.go b/power/client/service_bindings/service_binding_last_operation_get_responses.go index e71e8725..46779aad 100644 --- a/power/client/service_bindings/service_binding_last_operation_get_responses.go +++ b/power/client/service_bindings/service_binding_last_operation_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // ServiceBindingLastOperationGetReader is a Reader for the ServiceBindingLastOperationGet structure. @@ -24,30 +23,26 @@ type ServiceBindingLastOperationGetReader struct { // ReadResponse reads a server response into the received o. func (o *ServiceBindingLastOperationGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewServiceBindingLastOperationGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewServiceBindingLastOperationGetBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 410: result := NewServiceBindingLastOperationGetGone() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -56,7 +51,7 @@ func NewServiceBindingLastOperationGetOK() *ServiceBindingLastOperationGetOK { return &ServiceBindingLastOperationGetOK{} } -/*ServiceBindingLastOperationGetOK handles this case with default header values. +/* ServiceBindingLastOperationGetOK describes a response with status code 200, with default header values. OK */ @@ -67,6 +62,9 @@ type ServiceBindingLastOperationGetOK struct { func (o *ServiceBindingLastOperationGetOK) Error() string { return fmt.Sprintf("[GET /v2/service_instances/{instance_id}/service_bindings/{binding_id}/last_operation][%d] serviceBindingLastOperationGetOK %+v", 200, o.Payload) } +func (o *ServiceBindingLastOperationGetOK) GetPayload() *models.LastOperationResource { + return o.Payload +} func (o *ServiceBindingLastOperationGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -85,7 +83,7 @@ func NewServiceBindingLastOperationGetBadRequest() *ServiceBindingLastOperationG return &ServiceBindingLastOperationGetBadRequest{} } -/*ServiceBindingLastOperationGetBadRequest handles this case with default header values. +/* ServiceBindingLastOperationGetBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -96,6 +94,9 @@ type ServiceBindingLastOperationGetBadRequest struct { func (o *ServiceBindingLastOperationGetBadRequest) Error() string { return fmt.Sprintf("[GET /v2/service_instances/{instance_id}/service_bindings/{binding_id}/last_operation][%d] serviceBindingLastOperationGetBadRequest %+v", 400, o.Payload) } +func (o *ServiceBindingLastOperationGetBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBindingLastOperationGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -114,7 +115,7 @@ func NewServiceBindingLastOperationGetGone() *ServiceBindingLastOperationGetGone return &ServiceBindingLastOperationGetGone{} } -/*ServiceBindingLastOperationGetGone handles this case with default header values. +/* ServiceBindingLastOperationGetGone describes a response with status code 410, with default header values. Gone */ @@ -125,6 +126,9 @@ type ServiceBindingLastOperationGetGone struct { func (o *ServiceBindingLastOperationGetGone) Error() string { return fmt.Sprintf("[GET /v2/service_instances/{instance_id}/service_bindings/{binding_id}/last_operation][%d] serviceBindingLastOperationGetGone %+v", 410, o.Payload) } +func (o *ServiceBindingLastOperationGetGone) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBindingLastOperationGetGone) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/service_bindings/service_binding_unbinding_parameters.go b/power/client/service_bindings/service_binding_unbinding_parameters.go index 898dfe1b..fb2dc202 100644 --- a/power/client/service_bindings/service_binding_unbinding_parameters.go +++ b/power/client/service_bindings/service_binding_unbinding_parameters.go @@ -13,88 +13,92 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - - strfmt "github.com/go-openapi/strfmt" ) -// NewServiceBindingUnbindingParams creates a new ServiceBindingUnbindingParams object -// with the default values initialized. +// NewServiceBindingUnbindingParams creates a new ServiceBindingUnbindingParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewServiceBindingUnbindingParams() *ServiceBindingUnbindingParams { - var () return &ServiceBindingUnbindingParams{ - timeout: cr.DefaultTimeout, } } // NewServiceBindingUnbindingParamsWithTimeout creates a new ServiceBindingUnbindingParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewServiceBindingUnbindingParamsWithTimeout(timeout time.Duration) *ServiceBindingUnbindingParams { - var () return &ServiceBindingUnbindingParams{ - timeout: timeout, } } // NewServiceBindingUnbindingParamsWithContext creates a new ServiceBindingUnbindingParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewServiceBindingUnbindingParamsWithContext(ctx context.Context) *ServiceBindingUnbindingParams { - var () return &ServiceBindingUnbindingParams{ - Context: ctx, } } // NewServiceBindingUnbindingParamsWithHTTPClient creates a new ServiceBindingUnbindingParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewServiceBindingUnbindingParamsWithHTTPClient(client *http.Client) *ServiceBindingUnbindingParams { - var () return &ServiceBindingUnbindingParams{ HTTPClient: client, } } -/*ServiceBindingUnbindingParams contains all the parameters to send to the API endpoint -for the service binding unbinding operation typically these are written to a http.Request +/* ServiceBindingUnbindingParams contains all the parameters to send to the API endpoint + for the service binding unbinding operation. + + Typically these are written to a http.Request. */ type ServiceBindingUnbindingParams struct { - /*XBrokerAPIOriginatingIdentity - identity of the user that initiated the request from the Platform + /* XBrokerAPIOriginatingIdentity. + identity of the user that initiated the request from the Platform */ XBrokerAPIOriginatingIdentity *string - /*XBrokerAPIVersion - version number of the Service Broker API that the Platform will use + /* XBrokerAPIVersion. + + version number of the Service Broker API that the Platform will use */ XBrokerAPIVersion string - /*AcceptsIncomplete - asynchronous operations supported + /* AcceptsIncomplete. + + asynchronous operations supported */ AcceptsIncomplete *bool - /*BindingID - binding id of binding to create + /* BindingID. + + binding id of binding to create */ BindingID string - /*InstanceID - instance id of instance to provision + /* InstanceID. + + instance id of instance to provision */ InstanceID string - /*PlanID - id of the plan associated with the instance being deleted + /* PlanID. + + id of the plan associated with the instance being deleted */ PlanID string - /*ServiceID - id of the service associated with the instance being deleted + /* ServiceID. + + id of the service associated with the instance being deleted */ ServiceID string @@ -103,6 +107,21 @@ type ServiceBindingUnbindingParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the service binding unbinding params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBindingUnbindingParams) WithDefaults() *ServiceBindingUnbindingParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service binding unbinding params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBindingUnbindingParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the service binding unbinding params func (o *ServiceBindingUnbindingParams) WithTimeout(timeout time.Duration) *ServiceBindingUnbindingParams { o.SetTimeout(timeout) @@ -227,7 +246,6 @@ func (o *ServiceBindingUnbindingParams) WriteToRequest(r runtime.ClientRequest, if err := r.SetHeaderParam("X-Broker-API-Originating-Identity", *o.XBrokerAPIOriginatingIdentity); err != nil { return err } - } // header param X-Broker-API-Version @@ -239,16 +257,17 @@ func (o *ServiceBindingUnbindingParams) WriteToRequest(r runtime.ClientRequest, // query param accepts_incomplete var qrAcceptsIncomplete bool + if o.AcceptsIncomplete != nil { qrAcceptsIncomplete = *o.AcceptsIncomplete } qAcceptsIncomplete := swag.FormatBool(qrAcceptsIncomplete) if qAcceptsIncomplete != "" { + if err := r.SetQueryParam("accepts_incomplete", qAcceptsIncomplete); err != nil { return err } } - } // path param binding_id @@ -265,6 +284,7 @@ func (o *ServiceBindingUnbindingParams) WriteToRequest(r runtime.ClientRequest, qrPlanID := o.PlanID qPlanID := qrPlanID if qPlanID != "" { + if err := r.SetQueryParam("plan_id", qPlanID); err != nil { return err } @@ -274,6 +294,7 @@ func (o *ServiceBindingUnbindingParams) WriteToRequest(r runtime.ClientRequest, qrServiceID := o.ServiceID qServiceID := qrServiceID if qServiceID != "" { + if err := r.SetQueryParam("service_id", qServiceID); err != nil { return err } diff --git a/power/client/service_bindings/service_binding_unbinding_responses.go b/power/client/service_bindings/service_binding_unbinding_responses.go index f5ee2f94..2416449a 100644 --- a/power/client/service_bindings/service_binding_unbinding_responses.go +++ b/power/client/service_bindings/service_binding_unbinding_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // ServiceBindingUnbindingReader is a Reader for the ServiceBindingUnbinding structure. @@ -24,37 +23,32 @@ type ServiceBindingUnbindingReader struct { // ReadResponse reads a server response into the received o. func (o *ServiceBindingUnbindingReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewServiceBindingUnbindingOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 202: result := NewServiceBindingUnbindingAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewServiceBindingUnbindingBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 410: result := NewServiceBindingUnbindingGone() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -63,7 +57,7 @@ func NewServiceBindingUnbindingOK() *ServiceBindingUnbindingOK { return &ServiceBindingUnbindingOK{} } -/*ServiceBindingUnbindingOK handles this case with default header values. +/* ServiceBindingUnbindingOK describes a response with status code 200, with default header values. OK */ @@ -74,6 +68,9 @@ type ServiceBindingUnbindingOK struct { func (o *ServiceBindingUnbindingOK) Error() string { return fmt.Sprintf("[DELETE /v2/service_instances/{instance_id}/service_bindings/{binding_id}][%d] serviceBindingUnbindingOK %+v", 200, o.Payload) } +func (o *ServiceBindingUnbindingOK) GetPayload() models.Object { + return o.Payload +} func (o *ServiceBindingUnbindingOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -90,7 +87,7 @@ func NewServiceBindingUnbindingAccepted() *ServiceBindingUnbindingAccepted { return &ServiceBindingUnbindingAccepted{} } -/*ServiceBindingUnbindingAccepted handles this case with default header values. +/* ServiceBindingUnbindingAccepted describes a response with status code 202, with default header values. Accepted */ @@ -101,6 +98,9 @@ type ServiceBindingUnbindingAccepted struct { func (o *ServiceBindingUnbindingAccepted) Error() string { return fmt.Sprintf("[DELETE /v2/service_instances/{instance_id}/service_bindings/{binding_id}][%d] serviceBindingUnbindingAccepted %+v", 202, o.Payload) } +func (o *ServiceBindingUnbindingAccepted) GetPayload() *models.AsyncOperation { + return o.Payload +} func (o *ServiceBindingUnbindingAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -119,7 +119,7 @@ func NewServiceBindingUnbindingBadRequest() *ServiceBindingUnbindingBadRequest { return &ServiceBindingUnbindingBadRequest{} } -/*ServiceBindingUnbindingBadRequest handles this case with default header values. +/* ServiceBindingUnbindingBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -130,6 +130,9 @@ type ServiceBindingUnbindingBadRequest struct { func (o *ServiceBindingUnbindingBadRequest) Error() string { return fmt.Sprintf("[DELETE /v2/service_instances/{instance_id}/service_bindings/{binding_id}][%d] serviceBindingUnbindingBadRequest %+v", 400, o.Payload) } +func (o *ServiceBindingUnbindingBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBindingUnbindingBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -148,7 +151,7 @@ func NewServiceBindingUnbindingGone() *ServiceBindingUnbindingGone { return &ServiceBindingUnbindingGone{} } -/*ServiceBindingUnbindingGone handles this case with default header values. +/* ServiceBindingUnbindingGone describes a response with status code 410, with default header values. Gone */ @@ -159,6 +162,9 @@ type ServiceBindingUnbindingGone struct { func (o *ServiceBindingUnbindingGone) Error() string { return fmt.Sprintf("[DELETE /v2/service_instances/{instance_id}/service_bindings/{binding_id}][%d] serviceBindingUnbindingGone %+v", 410, o.Payload) } +func (o *ServiceBindingUnbindingGone) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBindingUnbindingGone) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/service_bindings/service_bindings_client.go b/power/client/service_bindings/service_bindings_client.go index f119dece..554b058d 100644 --- a/power/client/service_bindings/service_bindings_client.go +++ b/power/client/service_bindings/service_bindings_client.go @@ -6,13 +6,14 @@ package service_bindings // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/runtime" + "fmt" - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" ) // New creates a new service bindings API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { return &Client{transport: transport, formats: formats} } @@ -24,16 +25,31 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + ServiceBindingBinding(params *ServiceBindingBindingParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBindingBindingOK, *ServiceBindingBindingCreated, *ServiceBindingBindingAccepted, error) + + ServiceBindingGet(params *ServiceBindingGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBindingGetOK, error) + + ServiceBindingLastOperationGet(params *ServiceBindingLastOperationGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBindingLastOperationGetOK, error) + + ServiceBindingUnbinding(params *ServiceBindingUnbindingParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBindingUnbindingOK, *ServiceBindingUnbindingAccepted, error) + + SetTransport(transport runtime.ClientTransport) +} + /* -ServiceBindingBinding generations of a service binding + ServiceBindingBinding generations of a service binding */ -func (a *Client) ServiceBindingBinding(params *ServiceBindingBindingParams, authInfo runtime.ClientAuthInfoWriter) (*ServiceBindingBindingOK, *ServiceBindingBindingCreated, *ServiceBindingBindingAccepted, error) { +func (a *Client) ServiceBindingBinding(params *ServiceBindingBindingParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBindingBindingOK, *ServiceBindingBindingCreated, *ServiceBindingBindingAccepted, error) { // TODO: Validate the params before sending if params == nil { params = NewServiceBindingBindingParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "serviceBinding.binding", Method: "PUT", PathPattern: "/v2/service_instances/{instance_id}/service_bindings/{binding_id}", @@ -45,7 +61,12 @@ func (a *Client) ServiceBindingBinding(params *ServiceBindingBindingParams, auth AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, nil, nil, err } @@ -57,20 +78,20 @@ func (a *Client) ServiceBindingBinding(params *ServiceBindingBindingParams, auth case *ServiceBindingBindingAccepted: return nil, nil, value, nil } - return nil, nil, nil, nil - + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for service_bindings: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -ServiceBindingGet gets a service binding + ServiceBindingGet gets a service binding */ -func (a *Client) ServiceBindingGet(params *ServiceBindingGetParams, authInfo runtime.ClientAuthInfoWriter) (*ServiceBindingGetOK, error) { +func (a *Client) ServiceBindingGet(params *ServiceBindingGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBindingGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewServiceBindingGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "serviceBinding.get", Method: "GET", PathPattern: "/v2/service_instances/{instance_id}/service_bindings/{binding_id}", @@ -82,24 +103,34 @@ func (a *Client) ServiceBindingGet(params *ServiceBindingGetParams, authInfo run AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*ServiceBindingGetOK), nil - + success, ok := result.(*ServiceBindingGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for serviceBinding.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -ServiceBindingLastOperationGet lasts requested operation state for service binding + ServiceBindingLastOperationGet lasts requested operation state for service binding */ -func (a *Client) ServiceBindingLastOperationGet(params *ServiceBindingLastOperationGetParams, authInfo runtime.ClientAuthInfoWriter) (*ServiceBindingLastOperationGetOK, error) { +func (a *Client) ServiceBindingLastOperationGet(params *ServiceBindingLastOperationGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBindingLastOperationGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewServiceBindingLastOperationGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "serviceBinding.lastOperation.get", Method: "GET", PathPattern: "/v2/service_instances/{instance_id}/service_bindings/{binding_id}/last_operation", @@ -111,24 +142,34 @@ func (a *Client) ServiceBindingLastOperationGet(params *ServiceBindingLastOperat AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*ServiceBindingLastOperationGetOK), nil - + success, ok := result.(*ServiceBindingLastOperationGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for serviceBinding.lastOperation.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -ServiceBindingUnbinding deprovisions of a service binding + ServiceBindingUnbinding deprovisions of a service binding */ -func (a *Client) ServiceBindingUnbinding(params *ServiceBindingUnbindingParams, authInfo runtime.ClientAuthInfoWriter) (*ServiceBindingUnbindingOK, *ServiceBindingUnbindingAccepted, error) { +func (a *Client) ServiceBindingUnbinding(params *ServiceBindingUnbindingParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBindingUnbindingOK, *ServiceBindingUnbindingAccepted, error) { // TODO: Validate the params before sending if params == nil { params = NewServiceBindingUnbindingParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "serviceBinding.unbinding", Method: "DELETE", PathPattern: "/v2/service_instances/{instance_id}/service_bindings/{binding_id}", @@ -140,7 +181,12 @@ func (a *Client) ServiceBindingUnbinding(params *ServiceBindingUnbindingParams, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, nil, err } @@ -150,8 +196,9 @@ func (a *Client) ServiceBindingUnbinding(params *ServiceBindingUnbindingParams, case *ServiceBindingUnbindingAccepted: return nil, value, nil } - return nil, nil, nil - + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for service_bindings: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } // SetTransport changes the transport on the client diff --git a/power/client/service_instances/service_instance_deprovision_parameters.go b/power/client/service_instances/service_instance_deprovision_parameters.go index f2efcedf..a9f8033e 100644 --- a/power/client/service_instances/service_instance_deprovision_parameters.go +++ b/power/client/service_instances/service_instance_deprovision_parameters.go @@ -13,83 +13,86 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - - strfmt "github.com/go-openapi/strfmt" ) -// NewServiceInstanceDeprovisionParams creates a new ServiceInstanceDeprovisionParams object -// with the default values initialized. +// NewServiceInstanceDeprovisionParams creates a new ServiceInstanceDeprovisionParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewServiceInstanceDeprovisionParams() *ServiceInstanceDeprovisionParams { - var () return &ServiceInstanceDeprovisionParams{ - timeout: cr.DefaultTimeout, } } // NewServiceInstanceDeprovisionParamsWithTimeout creates a new ServiceInstanceDeprovisionParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewServiceInstanceDeprovisionParamsWithTimeout(timeout time.Duration) *ServiceInstanceDeprovisionParams { - var () return &ServiceInstanceDeprovisionParams{ - timeout: timeout, } } // NewServiceInstanceDeprovisionParamsWithContext creates a new ServiceInstanceDeprovisionParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewServiceInstanceDeprovisionParamsWithContext(ctx context.Context) *ServiceInstanceDeprovisionParams { - var () return &ServiceInstanceDeprovisionParams{ - Context: ctx, } } // NewServiceInstanceDeprovisionParamsWithHTTPClient creates a new ServiceInstanceDeprovisionParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewServiceInstanceDeprovisionParamsWithHTTPClient(client *http.Client) *ServiceInstanceDeprovisionParams { - var () return &ServiceInstanceDeprovisionParams{ HTTPClient: client, } } -/*ServiceInstanceDeprovisionParams contains all the parameters to send to the API endpoint -for the service instance deprovision operation typically these are written to a http.Request +/* ServiceInstanceDeprovisionParams contains all the parameters to send to the API endpoint + for the service instance deprovision operation. + + Typically these are written to a http.Request. */ type ServiceInstanceDeprovisionParams struct { - /*XBrokerAPIOriginatingIdentity - identity of the user that initiated the request from the Platform + /* XBrokerAPIOriginatingIdentity. + identity of the user that initiated the request from the Platform */ XBrokerAPIOriginatingIdentity *string - /*XBrokerAPIVersion - version number of the Service Broker API that the Platform will use + /* XBrokerAPIVersion. + + version number of the Service Broker API that the Platform will use */ XBrokerAPIVersion string - /*AcceptsIncomplete - asynchronous operations supported + /* AcceptsIncomplete. + + asynchronous operations supported */ AcceptsIncomplete *bool - /*InstanceID - instance id of instance to provision + /* InstanceID. + + instance id of instance to provision */ InstanceID string - /*PlanID - id of the plan associated with the instance being deleted + /* PlanID. + + id of the plan associated with the instance being deleted */ PlanID string - /*ServiceID - id of the service associated with the instance being deleted + /* ServiceID. + + id of the service associated with the instance being deleted */ ServiceID string @@ -98,6 +101,21 @@ type ServiceInstanceDeprovisionParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the service instance deprovision params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceInstanceDeprovisionParams) WithDefaults() *ServiceInstanceDeprovisionParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service instance deprovision params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceInstanceDeprovisionParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the service instance deprovision params func (o *ServiceInstanceDeprovisionParams) WithTimeout(timeout time.Duration) *ServiceInstanceDeprovisionParams { o.SetTimeout(timeout) @@ -211,7 +229,6 @@ func (o *ServiceInstanceDeprovisionParams) WriteToRequest(r runtime.ClientReques if err := r.SetHeaderParam("X-Broker-API-Originating-Identity", *o.XBrokerAPIOriginatingIdentity); err != nil { return err } - } // header param X-Broker-API-Version @@ -223,16 +240,17 @@ func (o *ServiceInstanceDeprovisionParams) WriteToRequest(r runtime.ClientReques // query param accepts_incomplete var qrAcceptsIncomplete bool + if o.AcceptsIncomplete != nil { qrAcceptsIncomplete = *o.AcceptsIncomplete } qAcceptsIncomplete := swag.FormatBool(qrAcceptsIncomplete) if qAcceptsIncomplete != "" { + if err := r.SetQueryParam("accepts_incomplete", qAcceptsIncomplete); err != nil { return err } } - } // path param instance_id @@ -244,6 +262,7 @@ func (o *ServiceInstanceDeprovisionParams) WriteToRequest(r runtime.ClientReques qrPlanID := o.PlanID qPlanID := qrPlanID if qPlanID != "" { + if err := r.SetQueryParam("plan_id", qPlanID); err != nil { return err } @@ -253,6 +272,7 @@ func (o *ServiceInstanceDeprovisionParams) WriteToRequest(r runtime.ClientReques qrServiceID := o.ServiceID qServiceID := qrServiceID if qServiceID != "" { + if err := r.SetQueryParam("service_id", qServiceID); err != nil { return err } diff --git a/power/client/service_instances/service_instance_deprovision_responses.go b/power/client/service_instances/service_instance_deprovision_responses.go index adfc8497..1ae4ec9d 100644 --- a/power/client/service_instances/service_instance_deprovision_responses.go +++ b/power/client/service_instances/service_instance_deprovision_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // ServiceInstanceDeprovisionReader is a Reader for the ServiceInstanceDeprovision structure. @@ -24,44 +23,38 @@ type ServiceInstanceDeprovisionReader struct { // ReadResponse reads a server response into the received o. func (o *ServiceInstanceDeprovisionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewServiceInstanceDeprovisionOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 202: result := NewServiceInstanceDeprovisionAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewServiceInstanceDeprovisionBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 410: result := NewServiceInstanceDeprovisionGone() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewServiceInstanceDeprovisionUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -70,7 +63,7 @@ func NewServiceInstanceDeprovisionOK() *ServiceInstanceDeprovisionOK { return &ServiceInstanceDeprovisionOK{} } -/*ServiceInstanceDeprovisionOK handles this case with default header values. +/* ServiceInstanceDeprovisionOK describes a response with status code 200, with default header values. OK */ @@ -81,6 +74,9 @@ type ServiceInstanceDeprovisionOK struct { func (o *ServiceInstanceDeprovisionOK) Error() string { return fmt.Sprintf("[DELETE /v2/service_instances/{instance_id}][%d] serviceInstanceDeprovisionOK %+v", 200, o.Payload) } +func (o *ServiceInstanceDeprovisionOK) GetPayload() models.Object { + return o.Payload +} func (o *ServiceInstanceDeprovisionOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -97,7 +93,7 @@ func NewServiceInstanceDeprovisionAccepted() *ServiceInstanceDeprovisionAccepted return &ServiceInstanceDeprovisionAccepted{} } -/*ServiceInstanceDeprovisionAccepted handles this case with default header values. +/* ServiceInstanceDeprovisionAccepted describes a response with status code 202, with default header values. Accepted */ @@ -108,6 +104,9 @@ type ServiceInstanceDeprovisionAccepted struct { func (o *ServiceInstanceDeprovisionAccepted) Error() string { return fmt.Sprintf("[DELETE /v2/service_instances/{instance_id}][%d] serviceInstanceDeprovisionAccepted %+v", 202, o.Payload) } +func (o *ServiceInstanceDeprovisionAccepted) GetPayload() *models.AsyncOperation { + return o.Payload +} func (o *ServiceInstanceDeprovisionAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -126,7 +125,7 @@ func NewServiceInstanceDeprovisionBadRequest() *ServiceInstanceDeprovisionBadReq return &ServiceInstanceDeprovisionBadRequest{} } -/*ServiceInstanceDeprovisionBadRequest handles this case with default header values. +/* ServiceInstanceDeprovisionBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -137,6 +136,9 @@ type ServiceInstanceDeprovisionBadRequest struct { func (o *ServiceInstanceDeprovisionBadRequest) Error() string { return fmt.Sprintf("[DELETE /v2/service_instances/{instance_id}][%d] serviceInstanceDeprovisionBadRequest %+v", 400, o.Payload) } +func (o *ServiceInstanceDeprovisionBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceInstanceDeprovisionBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -155,7 +157,7 @@ func NewServiceInstanceDeprovisionGone() *ServiceInstanceDeprovisionGone { return &ServiceInstanceDeprovisionGone{} } -/*ServiceInstanceDeprovisionGone handles this case with default header values. +/* ServiceInstanceDeprovisionGone describes a response with status code 410, with default header values. Gone */ @@ -166,6 +168,9 @@ type ServiceInstanceDeprovisionGone struct { func (o *ServiceInstanceDeprovisionGone) Error() string { return fmt.Sprintf("[DELETE /v2/service_instances/{instance_id}][%d] serviceInstanceDeprovisionGone %+v", 410, o.Payload) } +func (o *ServiceInstanceDeprovisionGone) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceInstanceDeprovisionGone) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -184,7 +189,7 @@ func NewServiceInstanceDeprovisionUnprocessableEntity() *ServiceInstanceDeprovis return &ServiceInstanceDeprovisionUnprocessableEntity{} } -/*ServiceInstanceDeprovisionUnprocessableEntity handles this case with default header values. +/* ServiceInstanceDeprovisionUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -195,6 +200,9 @@ type ServiceInstanceDeprovisionUnprocessableEntity struct { func (o *ServiceInstanceDeprovisionUnprocessableEntity) Error() string { return fmt.Sprintf("[DELETE /v2/service_instances/{instance_id}][%d] serviceInstanceDeprovisionUnprocessableEntity %+v", 422, o.Payload) } +func (o *ServiceInstanceDeprovisionUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceInstanceDeprovisionUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/service_instances/service_instance_get_parameters.go b/power/client/service_instances/service_instance_get_parameters.go index b9a16cfc..c3594fe6 100644 --- a/power/client/service_instances/service_instance_get_parameters.go +++ b/power/client/service_instances/service_instance_get_parameters.go @@ -13,67 +13,67 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewServiceInstanceGetParams creates a new ServiceInstanceGetParams object -// with the default values initialized. +// NewServiceInstanceGetParams creates a new ServiceInstanceGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewServiceInstanceGetParams() *ServiceInstanceGetParams { - var () return &ServiceInstanceGetParams{ - timeout: cr.DefaultTimeout, } } // NewServiceInstanceGetParamsWithTimeout creates a new ServiceInstanceGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewServiceInstanceGetParamsWithTimeout(timeout time.Duration) *ServiceInstanceGetParams { - var () return &ServiceInstanceGetParams{ - timeout: timeout, } } // NewServiceInstanceGetParamsWithContext creates a new ServiceInstanceGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewServiceInstanceGetParamsWithContext(ctx context.Context) *ServiceInstanceGetParams { - var () return &ServiceInstanceGetParams{ - Context: ctx, } } // NewServiceInstanceGetParamsWithHTTPClient creates a new ServiceInstanceGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewServiceInstanceGetParamsWithHTTPClient(client *http.Client) *ServiceInstanceGetParams { - var () return &ServiceInstanceGetParams{ HTTPClient: client, } } -/*ServiceInstanceGetParams contains all the parameters to send to the API endpoint -for the service instance get operation typically these are written to a http.Request +/* ServiceInstanceGetParams contains all the parameters to send to the API endpoint + for the service instance get operation. + + Typically these are written to a http.Request. */ type ServiceInstanceGetParams struct { - /*XBrokerAPIOriginatingIdentity - identity of the user that initiated the request from the Platform + /* XBrokerAPIOriginatingIdentity. + identity of the user that initiated the request from the Platform */ XBrokerAPIOriginatingIdentity *string - /*XBrokerAPIVersion - version number of the Service Broker API that the Platform will use + /* XBrokerAPIVersion. + + version number of the Service Broker API that the Platform will use */ XBrokerAPIVersion string - /*InstanceID - instance id of instance to provision + /* InstanceID. + + instance id of instance to provision */ InstanceID string @@ -82,6 +82,21 @@ type ServiceInstanceGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the service instance get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceInstanceGetParams) WithDefaults() *ServiceInstanceGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service instance get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceInstanceGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the service instance get params func (o *ServiceInstanceGetParams) WithTimeout(timeout time.Duration) *ServiceInstanceGetParams { o.SetTimeout(timeout) @@ -162,7 +177,6 @@ func (o *ServiceInstanceGetParams) WriteToRequest(r runtime.ClientRequest, reg s if err := r.SetHeaderParam("X-Broker-API-Originating-Identity", *o.XBrokerAPIOriginatingIdentity); err != nil { return err } - } // header param X-Broker-API-Version diff --git a/power/client/service_instances/service_instance_get_responses.go b/power/client/service_instances/service_instance_get_responses.go index 1bbb6989..94ecfeca 100644 --- a/power/client/service_instances/service_instance_get_responses.go +++ b/power/client/service_instances/service_instance_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // ServiceInstanceGetReader is a Reader for the ServiceInstanceGet structure. @@ -24,23 +23,20 @@ type ServiceInstanceGetReader struct { // ReadResponse reads a server response into the received o. func (o *ServiceInstanceGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewServiceInstanceGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 404: result := NewServiceInstanceGetNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -49,7 +45,7 @@ func NewServiceInstanceGetOK() *ServiceInstanceGetOK { return &ServiceInstanceGetOK{} } -/*ServiceInstanceGetOK handles this case with default header values. +/* ServiceInstanceGetOK describes a response with status code 200, with default header values. OK */ @@ -60,6 +56,9 @@ type ServiceInstanceGetOK struct { func (o *ServiceInstanceGetOK) Error() string { return fmt.Sprintf("[GET /v2/service_instances/{instance_id}][%d] serviceInstanceGetOK %+v", 200, o.Payload) } +func (o *ServiceInstanceGetOK) GetPayload() *models.ServiceInstanceResource { + return o.Payload +} func (o *ServiceInstanceGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -78,7 +77,7 @@ func NewServiceInstanceGetNotFound() *ServiceInstanceGetNotFound { return &ServiceInstanceGetNotFound{} } -/*ServiceInstanceGetNotFound handles this case with default header values. +/* ServiceInstanceGetNotFound describes a response with status code 404, with default header values. Not Found */ @@ -89,6 +88,9 @@ type ServiceInstanceGetNotFound struct { func (o *ServiceInstanceGetNotFound) Error() string { return fmt.Sprintf("[GET /v2/service_instances/{instance_id}][%d] serviceInstanceGetNotFound %+v", 404, o.Payload) } +func (o *ServiceInstanceGetNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceInstanceGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/service_instances/service_instance_last_operation_get_parameters.go b/power/client/service_instances/service_instance_last_operation_get_parameters.go index c6d90363..8c735cce 100644 --- a/power/client/service_instances/service_instance_last_operation_get_parameters.go +++ b/power/client/service_instances/service_instance_last_operation_get_parameters.go @@ -13,77 +13,79 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewServiceInstanceLastOperationGetParams creates a new ServiceInstanceLastOperationGetParams object -// with the default values initialized. +// NewServiceInstanceLastOperationGetParams creates a new ServiceInstanceLastOperationGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewServiceInstanceLastOperationGetParams() *ServiceInstanceLastOperationGetParams { - var () return &ServiceInstanceLastOperationGetParams{ - timeout: cr.DefaultTimeout, } } // NewServiceInstanceLastOperationGetParamsWithTimeout creates a new ServiceInstanceLastOperationGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewServiceInstanceLastOperationGetParamsWithTimeout(timeout time.Duration) *ServiceInstanceLastOperationGetParams { - var () return &ServiceInstanceLastOperationGetParams{ - timeout: timeout, } } // NewServiceInstanceLastOperationGetParamsWithContext creates a new ServiceInstanceLastOperationGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewServiceInstanceLastOperationGetParamsWithContext(ctx context.Context) *ServiceInstanceLastOperationGetParams { - var () return &ServiceInstanceLastOperationGetParams{ - Context: ctx, } } // NewServiceInstanceLastOperationGetParamsWithHTTPClient creates a new ServiceInstanceLastOperationGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewServiceInstanceLastOperationGetParamsWithHTTPClient(client *http.Client) *ServiceInstanceLastOperationGetParams { - var () return &ServiceInstanceLastOperationGetParams{ HTTPClient: client, } } -/*ServiceInstanceLastOperationGetParams contains all the parameters to send to the API endpoint -for the service instance last operation get operation typically these are written to a http.Request +/* ServiceInstanceLastOperationGetParams contains all the parameters to send to the API endpoint + for the service instance last operation get operation. + + Typically these are written to a http.Request. */ type ServiceInstanceLastOperationGetParams struct { - /*XBrokerAPIVersion - version number of the Service Broker API that the Platform will use + /* XBrokerAPIVersion. + version number of the Service Broker API that the Platform will use */ XBrokerAPIVersion string - /*InstanceID - instance id of instance to provision + /* InstanceID. + + instance id of instance to provision */ InstanceID string - /*Operation - a provided identifier for the operation + /* Operation. + + a provided identifier for the operation */ Operation *string - /*PlanID - id of the plan associated with the instance + /* PlanID. + + id of the plan associated with the instance */ PlanID *string - /*ServiceID - id of the service associated with the instance + /* ServiceID. + + id of the service associated with the instance */ ServiceID *string @@ -92,6 +94,21 @@ type ServiceInstanceLastOperationGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the service instance last operation get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceInstanceLastOperationGetParams) WithDefaults() *ServiceInstanceLastOperationGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service instance last operation get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceInstanceLastOperationGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the service instance last operation get params func (o *ServiceInstanceLastOperationGetParams) WithTimeout(timeout time.Duration) *ServiceInstanceLastOperationGetParams { o.SetTimeout(timeout) @@ -202,48 +219,51 @@ func (o *ServiceInstanceLastOperationGetParams) WriteToRequest(r runtime.ClientR // query param operation var qrOperation string + if o.Operation != nil { qrOperation = *o.Operation } qOperation := qrOperation if qOperation != "" { + if err := r.SetQueryParam("operation", qOperation); err != nil { return err } } - } if o.PlanID != nil { // query param plan_id var qrPlanID string + if o.PlanID != nil { qrPlanID = *o.PlanID } qPlanID := qrPlanID if qPlanID != "" { + if err := r.SetQueryParam("plan_id", qPlanID); err != nil { return err } } - } if o.ServiceID != nil { // query param service_id var qrServiceID string + if o.ServiceID != nil { qrServiceID = *o.ServiceID } qServiceID := qrServiceID if qServiceID != "" { + if err := r.SetQueryParam("service_id", qServiceID); err != nil { return err } } - } if len(res) > 0 { diff --git a/power/client/service_instances/service_instance_last_operation_get_responses.go b/power/client/service_instances/service_instance_last_operation_get_responses.go index 30123e35..10e635bf 100644 --- a/power/client/service_instances/service_instance_last_operation_get_responses.go +++ b/power/client/service_instances/service_instance_last_operation_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // ServiceInstanceLastOperationGetReader is a Reader for the ServiceInstanceLastOperationGet structure. @@ -24,30 +23,26 @@ type ServiceInstanceLastOperationGetReader struct { // ReadResponse reads a server response into the received o. func (o *ServiceInstanceLastOperationGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewServiceInstanceLastOperationGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewServiceInstanceLastOperationGetBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 410: result := NewServiceInstanceLastOperationGetGone() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -56,7 +51,7 @@ func NewServiceInstanceLastOperationGetOK() *ServiceInstanceLastOperationGetOK { return &ServiceInstanceLastOperationGetOK{} } -/*ServiceInstanceLastOperationGetOK handles this case with default header values. +/* ServiceInstanceLastOperationGetOK describes a response with status code 200, with default header values. OK */ @@ -67,6 +62,9 @@ type ServiceInstanceLastOperationGetOK struct { func (o *ServiceInstanceLastOperationGetOK) Error() string { return fmt.Sprintf("[GET /v2/service_instances/{instance_id}/last_operation][%d] serviceInstanceLastOperationGetOK %+v", 200, o.Payload) } +func (o *ServiceInstanceLastOperationGetOK) GetPayload() *models.LastOperationResource { + return o.Payload +} func (o *ServiceInstanceLastOperationGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -85,7 +83,7 @@ func NewServiceInstanceLastOperationGetBadRequest() *ServiceInstanceLastOperatio return &ServiceInstanceLastOperationGetBadRequest{} } -/*ServiceInstanceLastOperationGetBadRequest handles this case with default header values. +/* ServiceInstanceLastOperationGetBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -96,6 +94,9 @@ type ServiceInstanceLastOperationGetBadRequest struct { func (o *ServiceInstanceLastOperationGetBadRequest) Error() string { return fmt.Sprintf("[GET /v2/service_instances/{instance_id}/last_operation][%d] serviceInstanceLastOperationGetBadRequest %+v", 400, o.Payload) } +func (o *ServiceInstanceLastOperationGetBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceInstanceLastOperationGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -114,7 +115,7 @@ func NewServiceInstanceLastOperationGetGone() *ServiceInstanceLastOperationGetGo return &ServiceInstanceLastOperationGetGone{} } -/*ServiceInstanceLastOperationGetGone handles this case with default header values. +/* ServiceInstanceLastOperationGetGone describes a response with status code 410, with default header values. Gone */ @@ -125,6 +126,9 @@ type ServiceInstanceLastOperationGetGone struct { func (o *ServiceInstanceLastOperationGetGone) Error() string { return fmt.Sprintf("[GET /v2/service_instances/{instance_id}/last_operation][%d] serviceInstanceLastOperationGetGone %+v", 410, o.Payload) } +func (o *ServiceInstanceLastOperationGetGone) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceInstanceLastOperationGetGone) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/service_instances/service_instance_provision_parameters.go b/power/client/service_instances/service_instance_provision_parameters.go index 178a80e5..89458c04 100644 --- a/power/client/service_instances/service_instance_provision_parameters.go +++ b/power/client/service_instances/service_instance_provision_parameters.go @@ -13,80 +13,82 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewServiceInstanceProvisionParams creates a new ServiceInstanceProvisionParams object -// with the default values initialized. +// NewServiceInstanceProvisionParams creates a new ServiceInstanceProvisionParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewServiceInstanceProvisionParams() *ServiceInstanceProvisionParams { - var () return &ServiceInstanceProvisionParams{ - timeout: cr.DefaultTimeout, } } // NewServiceInstanceProvisionParamsWithTimeout creates a new ServiceInstanceProvisionParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewServiceInstanceProvisionParamsWithTimeout(timeout time.Duration) *ServiceInstanceProvisionParams { - var () return &ServiceInstanceProvisionParams{ - timeout: timeout, } } // NewServiceInstanceProvisionParamsWithContext creates a new ServiceInstanceProvisionParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewServiceInstanceProvisionParamsWithContext(ctx context.Context) *ServiceInstanceProvisionParams { - var () return &ServiceInstanceProvisionParams{ - Context: ctx, } } // NewServiceInstanceProvisionParamsWithHTTPClient creates a new ServiceInstanceProvisionParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewServiceInstanceProvisionParamsWithHTTPClient(client *http.Client) *ServiceInstanceProvisionParams { - var () return &ServiceInstanceProvisionParams{ HTTPClient: client, } } -/*ServiceInstanceProvisionParams contains all the parameters to send to the API endpoint -for the service instance provision operation typically these are written to a http.Request +/* ServiceInstanceProvisionParams contains all the parameters to send to the API endpoint + for the service instance provision operation. + + Typically these are written to a http.Request. */ type ServiceInstanceProvisionParams struct { - /*XBrokerAPIOriginatingIdentity - identity of the user that initiated the request from the Platform + /* XBrokerAPIOriginatingIdentity. + identity of the user that initiated the request from the Platform */ XBrokerAPIOriginatingIdentity *string - /*XBrokerAPIVersion - version number of the Service Broker API that the Platform will use + /* XBrokerAPIVersion. + + version number of the Service Broker API that the Platform will use */ XBrokerAPIVersion string - /*AcceptsIncomplete - asynchronous operations supported + /* AcceptsIncomplete. + + asynchronous operations supported */ AcceptsIncomplete *bool - /*Body - parameters for the requested service instance provision + /* Body. + + parameters for the requested service instance provision */ Body *models.ServiceInstanceProvisionRequest - /*InstanceID - instance id of instance to provision + /* InstanceID. + + instance id of instance to provision */ InstanceID string @@ -95,6 +97,21 @@ type ServiceInstanceProvisionParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the service instance provision params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceInstanceProvisionParams) WithDefaults() *ServiceInstanceProvisionParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service instance provision params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceInstanceProvisionParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the service instance provision params func (o *ServiceInstanceProvisionParams) WithTimeout(timeout time.Duration) *ServiceInstanceProvisionParams { o.SetTimeout(timeout) @@ -197,7 +214,6 @@ func (o *ServiceInstanceProvisionParams) WriteToRequest(r runtime.ClientRequest, if err := r.SetHeaderParam("X-Broker-API-Originating-Identity", *o.XBrokerAPIOriginatingIdentity); err != nil { return err } - } // header param X-Broker-API-Version @@ -209,18 +225,18 @@ func (o *ServiceInstanceProvisionParams) WriteToRequest(r runtime.ClientRequest, // query param accepts_incomplete var qrAcceptsIncomplete bool + if o.AcceptsIncomplete != nil { qrAcceptsIncomplete = *o.AcceptsIncomplete } qAcceptsIncomplete := swag.FormatBool(qrAcceptsIncomplete) if qAcceptsIncomplete != "" { + if err := r.SetQueryParam("accepts_incomplete", qAcceptsIncomplete); err != nil { return err } } - } - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/service_instances/service_instance_provision_responses.go b/power/client/service_instances/service_instance_provision_responses.go index 4f29ccbc..1b457b95 100644 --- a/power/client/service_instances/service_instance_provision_responses.go +++ b/power/client/service_instances/service_instance_provision_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // ServiceInstanceProvisionReader is a Reader for the ServiceInstanceProvision structure. @@ -24,51 +23,44 @@ type ServiceInstanceProvisionReader struct { // ReadResponse reads a server response into the received o. func (o *ServiceInstanceProvisionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewServiceInstanceProvisionOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 201: result := NewServiceInstanceProvisionCreated() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 202: result := NewServiceInstanceProvisionAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewServiceInstanceProvisionBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 409: result := NewServiceInstanceProvisionConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewServiceInstanceProvisionUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -77,7 +69,7 @@ func NewServiceInstanceProvisionOK() *ServiceInstanceProvisionOK { return &ServiceInstanceProvisionOK{} } -/*ServiceInstanceProvisionOK handles this case with default header values. +/* ServiceInstanceProvisionOK describes a response with status code 200, with default header values. OK */ @@ -88,6 +80,9 @@ type ServiceInstanceProvisionOK struct { func (o *ServiceInstanceProvisionOK) Error() string { return fmt.Sprintf("[PUT /v2/service_instances/{instance_id}][%d] serviceInstanceProvisionOK %+v", 200, o.Payload) } +func (o *ServiceInstanceProvisionOK) GetPayload() *models.ServiceInstanceProvision { + return o.Payload +} func (o *ServiceInstanceProvisionOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -106,7 +101,7 @@ func NewServiceInstanceProvisionCreated() *ServiceInstanceProvisionCreated { return &ServiceInstanceProvisionCreated{} } -/*ServiceInstanceProvisionCreated handles this case with default header values. +/* ServiceInstanceProvisionCreated describes a response with status code 201, with default header values. Created */ @@ -117,6 +112,9 @@ type ServiceInstanceProvisionCreated struct { func (o *ServiceInstanceProvisionCreated) Error() string { return fmt.Sprintf("[PUT /v2/service_instances/{instance_id}][%d] serviceInstanceProvisionCreated %+v", 201, o.Payload) } +func (o *ServiceInstanceProvisionCreated) GetPayload() *models.ServiceInstanceProvision { + return o.Payload +} func (o *ServiceInstanceProvisionCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -135,7 +133,7 @@ func NewServiceInstanceProvisionAccepted() *ServiceInstanceProvisionAccepted { return &ServiceInstanceProvisionAccepted{} } -/*ServiceInstanceProvisionAccepted handles this case with default header values. +/* ServiceInstanceProvisionAccepted describes a response with status code 202, with default header values. Accepted */ @@ -146,6 +144,9 @@ type ServiceInstanceProvisionAccepted struct { func (o *ServiceInstanceProvisionAccepted) Error() string { return fmt.Sprintf("[PUT /v2/service_instances/{instance_id}][%d] serviceInstanceProvisionAccepted %+v", 202, o.Payload) } +func (o *ServiceInstanceProvisionAccepted) GetPayload() *models.ServiceInstanceAsyncOperation { + return o.Payload +} func (o *ServiceInstanceProvisionAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -164,7 +165,7 @@ func NewServiceInstanceProvisionBadRequest() *ServiceInstanceProvisionBadRequest return &ServiceInstanceProvisionBadRequest{} } -/*ServiceInstanceProvisionBadRequest handles this case with default header values. +/* ServiceInstanceProvisionBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -175,6 +176,9 @@ type ServiceInstanceProvisionBadRequest struct { func (o *ServiceInstanceProvisionBadRequest) Error() string { return fmt.Sprintf("[PUT /v2/service_instances/{instance_id}][%d] serviceInstanceProvisionBadRequest %+v", 400, o.Payload) } +func (o *ServiceInstanceProvisionBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceInstanceProvisionBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -193,7 +197,7 @@ func NewServiceInstanceProvisionConflict() *ServiceInstanceProvisionConflict { return &ServiceInstanceProvisionConflict{} } -/*ServiceInstanceProvisionConflict handles this case with default header values. +/* ServiceInstanceProvisionConflict describes a response with status code 409, with default header values. Conflict */ @@ -204,6 +208,9 @@ type ServiceInstanceProvisionConflict struct { func (o *ServiceInstanceProvisionConflict) Error() string { return fmt.Sprintf("[PUT /v2/service_instances/{instance_id}][%d] serviceInstanceProvisionConflict %+v", 409, o.Payload) } +func (o *ServiceInstanceProvisionConflict) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceInstanceProvisionConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -222,7 +229,7 @@ func NewServiceInstanceProvisionUnprocessableEntity() *ServiceInstanceProvisionU return &ServiceInstanceProvisionUnprocessableEntity{} } -/*ServiceInstanceProvisionUnprocessableEntity handles this case with default header values. +/* ServiceInstanceProvisionUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable Entity */ @@ -233,6 +240,9 @@ type ServiceInstanceProvisionUnprocessableEntity struct { func (o *ServiceInstanceProvisionUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /v2/service_instances/{instance_id}][%d] serviceInstanceProvisionUnprocessableEntity %+v", 422, o.Payload) } +func (o *ServiceInstanceProvisionUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceInstanceProvisionUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/service_instances/service_instance_update_parameters.go b/power/client/service_instances/service_instance_update_parameters.go index 52a6ad67..0e27172b 100644 --- a/power/client/service_instances/service_instance_update_parameters.go +++ b/power/client/service_instances/service_instance_update_parameters.go @@ -13,80 +13,82 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) -// NewServiceInstanceUpdateParams creates a new ServiceInstanceUpdateParams object -// with the default values initialized. +// NewServiceInstanceUpdateParams creates a new ServiceInstanceUpdateParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewServiceInstanceUpdateParams() *ServiceInstanceUpdateParams { - var () return &ServiceInstanceUpdateParams{ - timeout: cr.DefaultTimeout, } } // NewServiceInstanceUpdateParamsWithTimeout creates a new ServiceInstanceUpdateParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewServiceInstanceUpdateParamsWithTimeout(timeout time.Duration) *ServiceInstanceUpdateParams { - var () return &ServiceInstanceUpdateParams{ - timeout: timeout, } } // NewServiceInstanceUpdateParamsWithContext creates a new ServiceInstanceUpdateParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewServiceInstanceUpdateParamsWithContext(ctx context.Context) *ServiceInstanceUpdateParams { - var () return &ServiceInstanceUpdateParams{ - Context: ctx, } } // NewServiceInstanceUpdateParamsWithHTTPClient creates a new ServiceInstanceUpdateParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewServiceInstanceUpdateParamsWithHTTPClient(client *http.Client) *ServiceInstanceUpdateParams { - var () return &ServiceInstanceUpdateParams{ HTTPClient: client, } } -/*ServiceInstanceUpdateParams contains all the parameters to send to the API endpoint -for the service instance update operation typically these are written to a http.Request +/* ServiceInstanceUpdateParams contains all the parameters to send to the API endpoint + for the service instance update operation. + + Typically these are written to a http.Request. */ type ServiceInstanceUpdateParams struct { - /*XBrokerAPIOriginatingIdentity - identity of the user that initiated the request from the Platform + /* XBrokerAPIOriginatingIdentity. + identity of the user that initiated the request from the Platform */ XBrokerAPIOriginatingIdentity *string - /*XBrokerAPIVersion - version number of the Service Broker API that the Platform will use + /* XBrokerAPIVersion. + + version number of the Service Broker API that the Platform will use */ XBrokerAPIVersion string - /*AcceptsIncomplete - asynchronous operations supported + /* AcceptsIncomplete. + + asynchronous operations supported */ AcceptsIncomplete *bool - /*Body - parameters for the requested service instance update + /* Body. + + parameters for the requested service instance update */ Body *models.ServiceInstanceUpdateRequest - /*InstanceID - instance id of instance to provision + /* InstanceID. + + instance id of instance to provision */ InstanceID string @@ -95,6 +97,21 @@ type ServiceInstanceUpdateParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the service instance update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceInstanceUpdateParams) WithDefaults() *ServiceInstanceUpdateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service instance update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceInstanceUpdateParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the service instance update params func (o *ServiceInstanceUpdateParams) WithTimeout(timeout time.Duration) *ServiceInstanceUpdateParams { o.SetTimeout(timeout) @@ -197,7 +214,6 @@ func (o *ServiceInstanceUpdateParams) WriteToRequest(r runtime.ClientRequest, re if err := r.SetHeaderParam("X-Broker-API-Originating-Identity", *o.XBrokerAPIOriginatingIdentity); err != nil { return err } - } // header param X-Broker-API-Version @@ -209,18 +225,18 @@ func (o *ServiceInstanceUpdateParams) WriteToRequest(r runtime.ClientRequest, re // query param accepts_incomplete var qrAcceptsIncomplete bool + if o.AcceptsIncomplete != nil { qrAcceptsIncomplete = *o.AcceptsIncomplete } qAcceptsIncomplete := swag.FormatBool(qrAcceptsIncomplete) if qAcceptsIncomplete != "" { + if err := r.SetQueryParam("accepts_incomplete", qAcceptsIncomplete); err != nil { return err } } - } - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/power/client/service_instances/service_instance_update_responses.go b/power/client/service_instances/service_instance_update_responses.go index 5780f592..b8656497 100644 --- a/power/client/service_instances/service_instance_update_responses.go +++ b/power/client/service_instances/service_instance_update_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // ServiceInstanceUpdateReader is a Reader for the ServiceInstanceUpdate structure. @@ -24,37 +23,32 @@ type ServiceInstanceUpdateReader struct { // ReadResponse reads a server response into the received o. func (o *ServiceInstanceUpdateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewServiceInstanceUpdateOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 202: result := NewServiceInstanceUpdateAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewServiceInstanceUpdateBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 422: result := NewServiceInstanceUpdateUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -63,7 +57,7 @@ func NewServiceInstanceUpdateOK() *ServiceInstanceUpdateOK { return &ServiceInstanceUpdateOK{} } -/*ServiceInstanceUpdateOK handles this case with default header values. +/* ServiceInstanceUpdateOK describes a response with status code 200, with default header values. OK */ @@ -74,6 +68,9 @@ type ServiceInstanceUpdateOK struct { func (o *ServiceInstanceUpdateOK) Error() string { return fmt.Sprintf("[PATCH /v2/service_instances/{instance_id}][%d] serviceInstanceUpdateOK %+v", 200, o.Payload) } +func (o *ServiceInstanceUpdateOK) GetPayload() models.Object { + return o.Payload +} func (o *ServiceInstanceUpdateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -90,7 +87,7 @@ func NewServiceInstanceUpdateAccepted() *ServiceInstanceUpdateAccepted { return &ServiceInstanceUpdateAccepted{} } -/*ServiceInstanceUpdateAccepted handles this case with default header values. +/* ServiceInstanceUpdateAccepted describes a response with status code 202, with default header values. Accepted */ @@ -101,6 +98,9 @@ type ServiceInstanceUpdateAccepted struct { func (o *ServiceInstanceUpdateAccepted) Error() string { return fmt.Sprintf("[PATCH /v2/service_instances/{instance_id}][%d] serviceInstanceUpdateAccepted %+v", 202, o.Payload) } +func (o *ServiceInstanceUpdateAccepted) GetPayload() *models.ServiceInstanceAsyncOperation { + return o.Payload +} func (o *ServiceInstanceUpdateAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -119,7 +119,7 @@ func NewServiceInstanceUpdateBadRequest() *ServiceInstanceUpdateBadRequest { return &ServiceInstanceUpdateBadRequest{} } -/*ServiceInstanceUpdateBadRequest handles this case with default header values. +/* ServiceInstanceUpdateBadRequest describes a response with status code 400, with default header values. Bad Request */ @@ -130,6 +130,9 @@ type ServiceInstanceUpdateBadRequest struct { func (o *ServiceInstanceUpdateBadRequest) Error() string { return fmt.Sprintf("[PATCH /v2/service_instances/{instance_id}][%d] serviceInstanceUpdateBadRequest %+v", 400, o.Payload) } +func (o *ServiceInstanceUpdateBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceInstanceUpdateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -148,7 +151,7 @@ func NewServiceInstanceUpdateUnprocessableEntity() *ServiceInstanceUpdateUnproce return &ServiceInstanceUpdateUnprocessableEntity{} } -/*ServiceInstanceUpdateUnprocessableEntity handles this case with default header values. +/* ServiceInstanceUpdateUnprocessableEntity describes a response with status code 422, with default header values. Unprocessable entity */ @@ -159,6 +162,9 @@ type ServiceInstanceUpdateUnprocessableEntity struct { func (o *ServiceInstanceUpdateUnprocessableEntity) Error() string { return fmt.Sprintf("[PATCH /v2/service_instances/{instance_id}][%d] serviceInstanceUpdateUnprocessableEntity %+v", 422, o.Payload) } +func (o *ServiceInstanceUpdateUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceInstanceUpdateUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/service_instances/service_instances_client.go b/power/client/service_instances/service_instances_client.go index 27b7469e..13b07b16 100644 --- a/power/client/service_instances/service_instances_client.go +++ b/power/client/service_instances/service_instances_client.go @@ -6,13 +6,14 @@ package service_instances // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/runtime" + "fmt" - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" ) // New creates a new service instances API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { return &Client{transport: transport, formats: formats} } @@ -24,16 +25,33 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + ServiceInstanceDeprovision(params *ServiceInstanceDeprovisionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceInstanceDeprovisionOK, *ServiceInstanceDeprovisionAccepted, error) + + ServiceInstanceGet(params *ServiceInstanceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceInstanceGetOK, error) + + ServiceInstanceLastOperationGet(params *ServiceInstanceLastOperationGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceInstanceLastOperationGetOK, error) + + ServiceInstanceProvision(params *ServiceInstanceProvisionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceInstanceProvisionOK, *ServiceInstanceProvisionCreated, *ServiceInstanceProvisionAccepted, error) + + ServiceInstanceUpdate(params *ServiceInstanceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceInstanceUpdateOK, *ServiceInstanceUpdateAccepted, error) + + SetTransport(transport runtime.ClientTransport) +} + /* -ServiceInstanceDeprovision deprovisions a service instance + ServiceInstanceDeprovision deprovisions a service instance */ -func (a *Client) ServiceInstanceDeprovision(params *ServiceInstanceDeprovisionParams, authInfo runtime.ClientAuthInfoWriter) (*ServiceInstanceDeprovisionOK, *ServiceInstanceDeprovisionAccepted, error) { +func (a *Client) ServiceInstanceDeprovision(params *ServiceInstanceDeprovisionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceInstanceDeprovisionOK, *ServiceInstanceDeprovisionAccepted, error) { // TODO: Validate the params before sending if params == nil { params = NewServiceInstanceDeprovisionParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "serviceInstance.deprovision", Method: "DELETE", PathPattern: "/v2/service_instances/{instance_id}", @@ -45,7 +63,12 @@ func (a *Client) ServiceInstanceDeprovision(params *ServiceInstanceDeprovisionPa AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, nil, err } @@ -55,20 +78,20 @@ func (a *Client) ServiceInstanceDeprovision(params *ServiceInstanceDeprovisionPa case *ServiceInstanceDeprovisionAccepted: return nil, value, nil } - return nil, nil, nil - + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for service_instances: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -ServiceInstanceGet gets a service instance + ServiceInstanceGet gets a service instance */ -func (a *Client) ServiceInstanceGet(params *ServiceInstanceGetParams, authInfo runtime.ClientAuthInfoWriter) (*ServiceInstanceGetOK, error) { +func (a *Client) ServiceInstanceGet(params *ServiceInstanceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceInstanceGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewServiceInstanceGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "serviceInstance.get", Method: "GET", PathPattern: "/v2/service_instances/{instance_id}", @@ -80,24 +103,34 @@ func (a *Client) ServiceInstanceGet(params *ServiceInstanceGetParams, authInfo r AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*ServiceInstanceGetOK), nil - + success, ok := result.(*ServiceInstanceGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for serviceInstance.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -ServiceInstanceLastOperationGet lasts requested operation state for service instance + ServiceInstanceLastOperationGet lasts requested operation state for service instance */ -func (a *Client) ServiceInstanceLastOperationGet(params *ServiceInstanceLastOperationGetParams, authInfo runtime.ClientAuthInfoWriter) (*ServiceInstanceLastOperationGetOK, error) { +func (a *Client) ServiceInstanceLastOperationGet(params *ServiceInstanceLastOperationGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceInstanceLastOperationGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewServiceInstanceLastOperationGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "serviceInstance.lastOperation.get", Method: "GET", PathPattern: "/v2/service_instances/{instance_id}/last_operation", @@ -109,24 +142,34 @@ func (a *Client) ServiceInstanceLastOperationGet(params *ServiceInstanceLastOper AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*ServiceInstanceLastOperationGetOK), nil - + success, ok := result.(*ServiceInstanceLastOperationGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for serviceInstance.lastOperation.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -ServiceInstanceProvision provisions a service instance + ServiceInstanceProvision provisions a service instance */ -func (a *Client) ServiceInstanceProvision(params *ServiceInstanceProvisionParams, authInfo runtime.ClientAuthInfoWriter) (*ServiceInstanceProvisionOK, *ServiceInstanceProvisionCreated, *ServiceInstanceProvisionAccepted, error) { +func (a *Client) ServiceInstanceProvision(params *ServiceInstanceProvisionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceInstanceProvisionOK, *ServiceInstanceProvisionCreated, *ServiceInstanceProvisionAccepted, error) { // TODO: Validate the params before sending if params == nil { params = NewServiceInstanceProvisionParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "serviceInstance.provision", Method: "PUT", PathPattern: "/v2/service_instances/{instance_id}", @@ -138,7 +181,12 @@ func (a *Client) ServiceInstanceProvision(params *ServiceInstanceProvisionParams AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, nil, nil, err } @@ -150,20 +198,20 @@ func (a *Client) ServiceInstanceProvision(params *ServiceInstanceProvisionParams case *ServiceInstanceProvisionAccepted: return nil, nil, value, nil } - return nil, nil, nil, nil - + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for service_instances: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -ServiceInstanceUpdate updates a service instance + ServiceInstanceUpdate updates a service instance */ -func (a *Client) ServiceInstanceUpdate(params *ServiceInstanceUpdateParams, authInfo runtime.ClientAuthInfoWriter) (*ServiceInstanceUpdateOK, *ServiceInstanceUpdateAccepted, error) { +func (a *Client) ServiceInstanceUpdate(params *ServiceInstanceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceInstanceUpdateOK, *ServiceInstanceUpdateAccepted, error) { // TODO: Validate the params before sending if params == nil { params = NewServiceInstanceUpdateParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "serviceInstance.update", Method: "PATCH", PathPattern: "/v2/service_instances/{instance_id}", @@ -175,7 +223,12 @@ func (a *Client) ServiceInstanceUpdate(params *ServiceInstanceUpdateParams, auth AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, nil, err } @@ -185,8 +238,9 @@ func (a *Client) ServiceInstanceUpdate(params *ServiceInstanceUpdateParams, auth case *ServiceInstanceUpdateAccepted: return nil, value, nil } - return nil, nil, nil - + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for service_instances: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } // SetTransport changes the transport on the client diff --git a/power/client/storage_types/service_broker_storagetypes_get_parameters.go b/power/client/storage_types/service_broker_storagetypes_get_parameters.go index 7567d135..932bb7a0 100644 --- a/power/client/storage_types/service_broker_storagetypes_get_parameters.go +++ b/power/client/storage_types/service_broker_storagetypes_get_parameters.go @@ -13,51 +13,49 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewServiceBrokerStoragetypesGetParams creates a new ServiceBrokerStoragetypesGetParams object -// with the default values initialized. +// NewServiceBrokerStoragetypesGetParams creates a new ServiceBrokerStoragetypesGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewServiceBrokerStoragetypesGetParams() *ServiceBrokerStoragetypesGetParams { - return &ServiceBrokerStoragetypesGetParams{ - timeout: cr.DefaultTimeout, } } // NewServiceBrokerStoragetypesGetParamsWithTimeout creates a new ServiceBrokerStoragetypesGetParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewServiceBrokerStoragetypesGetParamsWithTimeout(timeout time.Duration) *ServiceBrokerStoragetypesGetParams { - return &ServiceBrokerStoragetypesGetParams{ - timeout: timeout, } } // NewServiceBrokerStoragetypesGetParamsWithContext creates a new ServiceBrokerStoragetypesGetParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewServiceBrokerStoragetypesGetParamsWithContext(ctx context.Context) *ServiceBrokerStoragetypesGetParams { - return &ServiceBrokerStoragetypesGetParams{ - Context: ctx, } } // NewServiceBrokerStoragetypesGetParamsWithHTTPClient creates a new ServiceBrokerStoragetypesGetParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewServiceBrokerStoragetypesGetParamsWithHTTPClient(client *http.Client) *ServiceBrokerStoragetypesGetParams { - return &ServiceBrokerStoragetypesGetParams{ HTTPClient: client, } } -/*ServiceBrokerStoragetypesGetParams contains all the parameters to send to the API endpoint -for the service broker storagetypes get operation typically these are written to a http.Request +/* ServiceBrokerStoragetypesGetParams contains all the parameters to send to the API endpoint + for the service broker storagetypes get operation. + + Typically these are written to a http.Request. */ type ServiceBrokerStoragetypesGetParams struct { timeout time.Duration @@ -65,6 +63,21 @@ type ServiceBrokerStoragetypesGetParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the service broker storagetypes get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerStoragetypesGetParams) WithDefaults() *ServiceBrokerStoragetypesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker storagetypes get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerStoragetypesGetParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the service broker storagetypes get params func (o *ServiceBrokerStoragetypesGetParams) WithTimeout(timeout time.Duration) *ServiceBrokerStoragetypesGetParams { o.SetTimeout(timeout) diff --git a/power/client/storage_types/service_broker_storagetypes_get_responses.go b/power/client/storage_types/service_broker_storagetypes_get_responses.go index 9ed46be1..30d420dd 100644 --- a/power/client/storage_types/service_broker_storagetypes_get_responses.go +++ b/power/client/storage_types/service_broker_storagetypes_get_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // ServiceBrokerStoragetypesGetReader is a Reader for the ServiceBrokerStoragetypesGet structure. @@ -24,23 +23,20 @@ type ServiceBrokerStoragetypesGetReader struct { // ReadResponse reads a server response into the received o. func (o *ServiceBrokerStoragetypesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewServiceBrokerStoragetypesGetOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 500: result := NewServiceBrokerStoragetypesGetInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -49,7 +45,7 @@ func NewServiceBrokerStoragetypesGetOK() *ServiceBrokerStoragetypesGetOK { return &ServiceBrokerStoragetypesGetOK{} } -/*ServiceBrokerStoragetypesGetOK handles this case with default header values. +/* ServiceBrokerStoragetypesGetOK describes a response with status code 200, with default header values. OK */ @@ -60,6 +56,9 @@ type ServiceBrokerStoragetypesGetOK struct { func (o *ServiceBrokerStoragetypesGetOK) Error() string { return fmt.Sprintf("[GET /broker/v1/storage-types][%d] serviceBrokerStoragetypesGetOK %+v", 200, o.Payload) } +func (o *ServiceBrokerStoragetypesGetOK) GetPayload() models.StorageTypes { + return o.Payload +} func (o *ServiceBrokerStoragetypesGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -76,7 +75,7 @@ func NewServiceBrokerStoragetypesGetInternalServerError() *ServiceBrokerStoraget return &ServiceBrokerStoragetypesGetInternalServerError{} } -/*ServiceBrokerStoragetypesGetInternalServerError handles this case with default header values. +/* ServiceBrokerStoragetypesGetInternalServerError describes a response with status code 500, with default header values. Internal Server Error */ @@ -87,6 +86,9 @@ type ServiceBrokerStoragetypesGetInternalServerError struct { func (o *ServiceBrokerStoragetypesGetInternalServerError) Error() string { return fmt.Sprintf("[GET /broker/v1/storage-types][%d] serviceBrokerStoragetypesGetInternalServerError %+v", 500, o.Payload) } +func (o *ServiceBrokerStoragetypesGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *ServiceBrokerStoragetypesGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/storage_types/storage_types_client.go b/power/client/storage_types/storage_types_client.go index 5359c424..5adc4f1e 100644 --- a/power/client/storage_types/storage_types_client.go +++ b/power/client/storage_types/storage_types_client.go @@ -6,13 +6,14 @@ package storage_types // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/runtime" + "fmt" - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" ) // New creates a new storage types API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { return &Client{transport: transport, formats: formats} } @@ -24,16 +25,25 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + ServiceBrokerStoragetypesGet(params *ServiceBrokerStoragetypesGetParams, opts ...ClientOption) (*ServiceBrokerStoragetypesGetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + /* -ServiceBrokerStoragetypesGet availables storage types in a region + ServiceBrokerStoragetypesGet availables storage types in a region */ -func (a *Client) ServiceBrokerStoragetypesGet(params *ServiceBrokerStoragetypesGetParams) (*ServiceBrokerStoragetypesGetOK, error) { +func (a *Client) ServiceBrokerStoragetypesGet(params *ServiceBrokerStoragetypesGetParams, opts ...ClientOption) (*ServiceBrokerStoragetypesGetOK, error) { // TODO: Validate the params before sending if params == nil { params = NewServiceBrokerStoragetypesGetParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "serviceBroker.storagetypes.get", Method: "GET", PathPattern: "/broker/v1/storage-types", @@ -44,12 +54,23 @@ func (a *Client) ServiceBrokerStoragetypesGet(params *ServiceBrokerStoragetypesG Reader: &ServiceBrokerStoragetypesGetReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*ServiceBrokerStoragetypesGetOK), nil - + success, ok := result.(*ServiceBrokerStoragetypesGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for serviceBroker.storagetypes.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } // SetTransport changes the transport on the client diff --git a/power/client/swagger_spec/service_broker_swaggerspec_parameters.go b/power/client/swagger_spec/service_broker_swaggerspec_parameters.go index e57a82db..12c76c9d 100644 --- a/power/client/swagger_spec/service_broker_swaggerspec_parameters.go +++ b/power/client/swagger_spec/service_broker_swaggerspec_parameters.go @@ -13,51 +13,49 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewServiceBrokerSwaggerspecParams creates a new ServiceBrokerSwaggerspecParams object -// with the default values initialized. +// NewServiceBrokerSwaggerspecParams creates a new ServiceBrokerSwaggerspecParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewServiceBrokerSwaggerspecParams() *ServiceBrokerSwaggerspecParams { - return &ServiceBrokerSwaggerspecParams{ - timeout: cr.DefaultTimeout, } } // NewServiceBrokerSwaggerspecParamsWithTimeout creates a new ServiceBrokerSwaggerspecParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewServiceBrokerSwaggerspecParamsWithTimeout(timeout time.Duration) *ServiceBrokerSwaggerspecParams { - return &ServiceBrokerSwaggerspecParams{ - timeout: timeout, } } // NewServiceBrokerSwaggerspecParamsWithContext creates a new ServiceBrokerSwaggerspecParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewServiceBrokerSwaggerspecParamsWithContext(ctx context.Context) *ServiceBrokerSwaggerspecParams { - return &ServiceBrokerSwaggerspecParams{ - Context: ctx, } } // NewServiceBrokerSwaggerspecParamsWithHTTPClient creates a new ServiceBrokerSwaggerspecParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewServiceBrokerSwaggerspecParamsWithHTTPClient(client *http.Client) *ServiceBrokerSwaggerspecParams { - return &ServiceBrokerSwaggerspecParams{ HTTPClient: client, } } -/*ServiceBrokerSwaggerspecParams contains all the parameters to send to the API endpoint -for the service broker swaggerspec operation typically these are written to a http.Request +/* ServiceBrokerSwaggerspecParams contains all the parameters to send to the API endpoint + for the service broker swaggerspec operation. + + Typically these are written to a http.Request. */ type ServiceBrokerSwaggerspecParams struct { timeout time.Duration @@ -65,6 +63,21 @@ type ServiceBrokerSwaggerspecParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the service broker swaggerspec params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerSwaggerspecParams) WithDefaults() *ServiceBrokerSwaggerspecParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker swaggerspec params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerSwaggerspecParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the service broker swaggerspec params func (o *ServiceBrokerSwaggerspecParams) WithTimeout(timeout time.Duration) *ServiceBrokerSwaggerspecParams { o.SetTimeout(timeout) diff --git a/power/client/swagger_spec/service_broker_swaggerspec_responses.go b/power/client/swagger_spec/service_broker_swaggerspec_responses.go index a2942f90..7f37f6cd 100644 --- a/power/client/swagger_spec/service_broker_swaggerspec_responses.go +++ b/power/client/swagger_spec/service_broker_swaggerspec_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM-Cloud/power-go-client/power/models" ) // ServiceBrokerSwaggerspecReader is a Reader for the ServiceBrokerSwaggerspec structure. @@ -24,16 +23,14 @@ type ServiceBrokerSwaggerspecReader struct { // ReadResponse reads a server response into the received o. func (o *ServiceBrokerSwaggerspecReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewServiceBrokerSwaggerspecOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -42,7 +39,7 @@ func NewServiceBrokerSwaggerspecOK() *ServiceBrokerSwaggerspecOK { return &ServiceBrokerSwaggerspecOK{} } -/*ServiceBrokerSwaggerspecOK handles this case with default header values. +/* ServiceBrokerSwaggerspecOK describes a response with status code 200, with default header values. OK */ @@ -53,6 +50,9 @@ type ServiceBrokerSwaggerspecOK struct { func (o *ServiceBrokerSwaggerspecOK) Error() string { return fmt.Sprintf("[GET /v1/swagger.json][%d] serviceBrokerSwaggerspecOK %+v", 200, o.Payload) } +func (o *ServiceBrokerSwaggerspecOK) GetPayload() models.Object { + return o.Payload +} func (o *ServiceBrokerSwaggerspecOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/power/client/swagger_spec/swagger_spec_client.go b/power/client/swagger_spec/swagger_spec_client.go index 8f9e1a05..d6ba1ec1 100644 --- a/power/client/swagger_spec/swagger_spec_client.go +++ b/power/client/swagger_spec/swagger_spec_client.go @@ -6,13 +6,14 @@ package swagger_spec // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/runtime" + "fmt" - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" ) // New creates a new swagger spec API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { return &Client{transport: transport, formats: formats} } @@ -24,16 +25,25 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + ServiceBrokerSwaggerspec(params *ServiceBrokerSwaggerspecParams, opts ...ClientOption) (*ServiceBrokerSwaggerspecOK, error) + + SetTransport(transport runtime.ClientTransport) +} + /* -ServiceBrokerSwaggerspec gets swagger json spec + ServiceBrokerSwaggerspec gets swagger json spec */ -func (a *Client) ServiceBrokerSwaggerspec(params *ServiceBrokerSwaggerspecParams) (*ServiceBrokerSwaggerspecOK, error) { +func (a *Client) ServiceBrokerSwaggerspec(params *ServiceBrokerSwaggerspecParams, opts ...ClientOption) (*ServiceBrokerSwaggerspecOK, error) { // TODO: Validate the params before sending if params == nil { params = NewServiceBrokerSwaggerspecParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "serviceBroker.swaggerspec", Method: "GET", PathPattern: "/v1/swagger.json", @@ -44,12 +54,23 @@ func (a *Client) ServiceBrokerSwaggerspec(params *ServiceBrokerSwaggerspecParams Reader: &ServiceBrokerSwaggerspecReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*ServiceBrokerSwaggerspecOK), nil - + success, ok := result.(*ServiceBrokerSwaggerspecOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for serviceBroker.swaggerspec: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } // SetTransport changes the transport on the client diff --git a/power/models/access_token.go b/power/models/access_token.go index 6efa42aa..adc43d9e 100644 --- a/power/models/access_token.go +++ b/power/models/access_token.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // AccessToken access token +// // swagger:model AccessToken type AccessToken struct { @@ -45,6 +47,11 @@ func (m *AccessToken) validateAccessToken(formats strfmt.Registry) error { return nil } +// ContextValidate validates this access token based on context it is used +func (m *AccessToken) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *AccessToken) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/async_operation.go b/power/models/async_operation.go index 33b1dc40..4fe92562 100644 --- a/power/models/async_operation.go +++ b/power/models/async_operation.go @@ -6,12 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // AsyncOperation async operation +// // swagger:model AsyncOperation type AsyncOperation struct { @@ -24,6 +26,11 @@ func (m *AsyncOperation) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this async operation based on context it is used +func (m *AsyncOperation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *AsyncOperation) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/available_stock_images.go b/power/models/available_stock_images.go index 711845a3..ba40ca2d 100644 --- a/power/models/available_stock_images.go +++ b/power/models/available_stock_images.go @@ -6,13 +6,15 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/validate" ) // AvailableStockImages A map of an array of stock images for each available storage type +// // swagger:model AvailableStockImages type AvailableStockImages map[string]StockImages @@ -29,6 +31,31 @@ func (m AvailableStockImages) Validate(formats strfmt.Registry) error { if err := m[k].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName(k) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(k) + } + return err + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validate this available stock images based on the context it is used +func (m AvailableStockImages) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + for k := range m { + + if err := m[k].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(k) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(k) } return err } diff --git a/power/models/catalog.go b/power/models/catalog.go index e60918ec..dab6aafe 100644 --- a/power/models/catalog.go +++ b/power/models/catalog.go @@ -6,15 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // Catalog catalog +// // swagger:model Catalog type Catalog struct { @@ -37,7 +38,6 @@ func (m *Catalog) Validate(formats strfmt.Registry) error { } func (m *Catalog) validateServices(formats strfmt.Registry) error { - if swag.IsZero(m.Services) { // not required return nil } @@ -51,6 +51,42 @@ func (m *Catalog) validateServices(formats strfmt.Registry) error { if err := m.Services[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("services" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("services" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this catalog based on the context it is used +func (m *Catalog) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateServices(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Catalog) contextValidateServices(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Services); i++ { + + if m.Services[i] != nil { + if err := m.Services[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("services" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("services" + "." + strconv.Itoa(i)) } return err } diff --git a/power/models/clone_task_reference.go b/power/models/clone_task_reference.go index bd777a2d..80464044 100644 --- a/power/models/clone_task_reference.go +++ b/power/models/clone_task_reference.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // CloneTaskReference clone task reference +// // swagger:model CloneTaskReference type CloneTaskReference struct { @@ -62,6 +64,11 @@ func (m *CloneTaskReference) validateHref(formats strfmt.Registry) error { return nil } +// ContextValidate validates this clone task reference based on context it is used +func (m *CloneTaskReference) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *CloneTaskReference) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/clone_task_status.go b/power/models/clone_task_status.go index 9788a646..c17b76df 100644 --- a/power/models/clone_task_status.go +++ b/power/models/clone_task_status.go @@ -6,17 +6,18 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // CloneTaskStatus clone task status +// // swagger:model CloneTaskStatus type CloneTaskStatus struct { @@ -59,7 +60,6 @@ func (m *CloneTaskStatus) Validate(formats strfmt.Registry) error { } func (m *CloneTaskStatus) validateClonedVolumes(formats strfmt.Registry) error { - if swag.IsZero(m.ClonedVolumes) { // not required return nil } @@ -73,6 +73,8 @@ func (m *CloneTaskStatus) validateClonedVolumes(formats strfmt.Registry) error { if err := m.ClonedVolumes[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("clonedVolumes" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("clonedVolumes" + "." + strconv.Itoa(i)) } return err } @@ -121,7 +123,7 @@ const ( // prop value enum func (m *CloneTaskStatus) validateStatusEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, cloneTaskStatusTypeStatusPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, cloneTaskStatusTypeStatusPropEnum, true); err != nil { return err } return nil @@ -141,6 +143,40 @@ func (m *CloneTaskStatus) validateStatus(formats strfmt.Registry) error { return nil } +// ContextValidate validate this clone task status based on the context it is used +func (m *CloneTaskStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateClonedVolumes(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloneTaskStatus) contextValidateClonedVolumes(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.ClonedVolumes); i++ { + + if m.ClonedVolumes[i] != nil { + if err := m.ClonedVolumes[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("clonedVolumes" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("clonedVolumes" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *CloneTaskStatus) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/cloned_volume.go b/power/models/cloned_volume.go index 2c525f2e..0431ea99 100644 --- a/power/models/cloned_volume.go +++ b/power/models/cloned_volume.go @@ -6,12 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ClonedVolume cloned volume +// // swagger:model ClonedVolume type ClonedVolume struct { @@ -27,6 +29,11 @@ func (m *ClonedVolume) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this cloned volume based on context it is used +func (m *ClonedVolume) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ClonedVolume) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/cloned_volume_detail.go b/power/models/cloned_volume_detail.go index 50910571..67757963 100644 --- a/power/models/cloned_volume_detail.go +++ b/power/models/cloned_volume_detail.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // ClonedVolumeDetail cloned volume detail +// // swagger:model ClonedVolumeDetail type ClonedVolumeDetail struct { @@ -54,6 +56,8 @@ func (m *ClonedVolumeDetail) validateClone(formats strfmt.Registry) error { if err := m.Clone.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("clone") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("clone") } return err } @@ -72,6 +76,58 @@ func (m *ClonedVolumeDetail) validateSource(formats strfmt.Registry) error { if err := m.Source.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("source") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("source") + } + return err + } + } + + return nil +} + +// ContextValidate validate this cloned volume detail based on the context it is used +func (m *ClonedVolumeDetail) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateClone(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSource(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ClonedVolumeDetail) contextValidateClone(ctx context.Context, formats strfmt.Registry) error { + + if m.Clone != nil { + if err := m.Clone.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("clone") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("clone") + } + return err + } + } + + return nil +} + +func (m *ClonedVolumeDetail) contextValidateSource(ctx context.Context, formats strfmt.Registry) error { + + if m.Source != nil { + if err := m.Source.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("source") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("source") } return err } diff --git a/power/models/cloud_connection.go b/power/models/cloud_connection.go index 5aed5a66..b61c4a05 100644 --- a/power/models/cloud_connection.go +++ b/power/models/cloud_connection.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // CloudConnection cloud connection +// // swagger:model CloudConnection type CloudConnection struct { @@ -133,7 +134,6 @@ func (m *CloudConnection) Validate(formats strfmt.Registry) error { } func (m *CloudConnection) validateClassic(formats strfmt.Registry) error { - if swag.IsZero(m.Classic) { // not required return nil } @@ -142,6 +142,8 @@ func (m *CloudConnection) validateClassic(formats strfmt.Registry) error { if err := m.Classic.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("classic") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("classic") } return err } @@ -218,7 +220,6 @@ func (m *CloudConnection) validateName(formats strfmt.Registry) error { } func (m *CloudConnection) validateNetworks(formats strfmt.Registry) error { - if swag.IsZero(m.Networks) { // not required return nil } @@ -232,6 +233,8 @@ func (m *CloudConnection) validateNetworks(formats strfmt.Registry) error { if err := m.Networks[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("networks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networks" + "." + strconv.Itoa(i)) } return err } @@ -270,7 +273,6 @@ func (m *CloudConnection) validateUserIPAddress(formats strfmt.Registry) error { } func (m *CloudConnection) validateVpc(formats strfmt.Registry) error { - if swag.IsZero(m.Vpc) { // not required return nil } @@ -279,6 +281,82 @@ func (m *CloudConnection) validateVpc(formats strfmt.Registry) error { if err := m.Vpc.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("vpc") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vpc") + } + return err + } + } + + return nil +} + +// ContextValidate validate this cloud connection based on the context it is used +func (m *CloudConnection) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateClassic(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateNetworks(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateVpc(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudConnection) contextValidateClassic(ctx context.Context, formats strfmt.Registry) error { + + if m.Classic != nil { + if err := m.Classic.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("classic") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("classic") + } + return err + } + } + + return nil +} + +func (m *CloudConnection) contextValidateNetworks(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Networks); i++ { + + if m.Networks[i] != nil { + if err := m.Networks[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CloudConnection) contextValidateVpc(ctx context.Context, formats strfmt.Registry) error { + + if m.Vpc != nil { + if err := m.Vpc.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vpc") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vpc") } return err } diff --git a/power/models/cloud_connection_create.go b/power/models/cloud_connection_create.go index 22f566f4..12231ad9 100644 --- a/power/models/cloud_connection_create.go +++ b/power/models/cloud_connection_create.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // CloudConnectionCreate cloud connection create +// // swagger:model CloudConnectionCreate type CloudConnectionCreate struct { @@ -71,7 +72,6 @@ func (m *CloudConnectionCreate) Validate(formats strfmt.Registry) error { } func (m *CloudConnectionCreate) validateClassic(formats strfmt.Registry) error { - if swag.IsZero(m.Classic) { // not required return nil } @@ -80,6 +80,8 @@ func (m *CloudConnectionCreate) validateClassic(formats strfmt.Registry) error { if err := m.Classic.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("classic") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("classic") } return err } @@ -111,7 +113,7 @@ func init() { // prop value enum func (m *CloudConnectionCreate) validateSpeedEnum(path, location string, value int64) error { - if err := validate.Enum(path, location, value, cloudConnectionCreateTypeSpeedPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, cloudConnectionCreateTypeSpeedPropEnum, true); err != nil { return err } return nil @@ -132,7 +134,6 @@ func (m *CloudConnectionCreate) validateSpeed(formats strfmt.Registry) error { } func (m *CloudConnectionCreate) validateVpc(formats strfmt.Registry) error { - if swag.IsZero(m.Vpc) { // not required return nil } @@ -141,6 +142,58 @@ func (m *CloudConnectionCreate) validateVpc(formats strfmt.Registry) error { if err := m.Vpc.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("vpc") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vpc") + } + return err + } + } + + return nil +} + +// ContextValidate validate this cloud connection create based on the context it is used +func (m *CloudConnectionCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateClassic(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateVpc(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudConnectionCreate) contextValidateClassic(ctx context.Context, formats strfmt.Registry) error { + + if m.Classic != nil { + if err := m.Classic.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("classic") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("classic") + } + return err + } + } + + return nil +} + +func (m *CloudConnectionCreate) contextValidateVpc(ctx context.Context, formats strfmt.Registry) error { + + if m.Vpc != nil { + if err := m.Vpc.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vpc") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vpc") } return err } diff --git a/power/models/cloud_connection_create_response.go b/power/models/cloud_connection_create_response.go index 6977373a..cf8c0899 100644 --- a/power/models/cloud_connection_create_response.go +++ b/power/models/cloud_connection_create_response.go @@ -6,13 +6,15 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // CloudConnectionCreateResponse cloud connection create response +// // swagger:model CloudConnectionCreateResponse type CloudConnectionCreateResponse struct { CloudConnection @@ -86,7 +88,6 @@ func (m *CloudConnectionCreateResponse) Validate(formats strfmt.Registry) error } func (m *CloudConnectionCreateResponse) validateJobRef(formats strfmt.Registry) error { - if swag.IsZero(m.JobRef) { // not required return nil } @@ -95,6 +96,43 @@ func (m *CloudConnectionCreateResponse) validateJobRef(formats strfmt.Registry) if err := m.JobRef.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("jobRef") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("jobRef") + } + return err + } + } + + return nil +} + +// ContextValidate validate this cloud connection create response based on the context it is used +func (m *CloudConnectionCreateResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with CloudConnection + if err := m.CloudConnection.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateJobRef(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudConnectionCreateResponse) contextValidateJobRef(ctx context.Context, formats strfmt.Registry) error { + + if m.JobRef != nil { + if err := m.JobRef.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("jobRef") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("jobRef") } return err } diff --git a/power/models/cloud_connection_endpoint_classic.go b/power/models/cloud_connection_endpoint_classic.go index 3ff28f5b..9ca73c49 100644 --- a/power/models/cloud_connection_endpoint_classic.go +++ b/power/models/cloud_connection_endpoint_classic.go @@ -6,13 +6,15 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // CloudConnectionEndpointClassic cloud connection endpoint classic +// // swagger:model CloudConnectionEndpointClassic type CloudConnectionEndpointClassic struct { @@ -38,7 +40,6 @@ func (m *CloudConnectionEndpointClassic) Validate(formats strfmt.Registry) error } func (m *CloudConnectionEndpointClassic) validateGre(formats strfmt.Registry) error { - if swag.IsZero(m.Gre) { // not required return nil } @@ -47,6 +48,38 @@ func (m *CloudConnectionEndpointClassic) validateGre(formats strfmt.Registry) er if err := m.Gre.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("gre") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("gre") + } + return err + } + } + + return nil +} + +// ContextValidate validate this cloud connection endpoint classic based on the context it is used +func (m *CloudConnectionEndpointClassic) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateGre(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudConnectionEndpointClassic) contextValidateGre(ctx context.Context, formats strfmt.Registry) error { + + if m.Gre != nil { + if err := m.Gre.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gre") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("gre") } return err } diff --git a/power/models/cloud_connection_endpoint_classic_update.go b/power/models/cloud_connection_endpoint_classic_update.go index 97a3ad65..300fef2a 100644 --- a/power/models/cloud_connection_endpoint_classic_update.go +++ b/power/models/cloud_connection_endpoint_classic_update.go @@ -6,13 +6,15 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // CloudConnectionEndpointClassicUpdate cloud connection endpoint classic update +// // swagger:model CloudConnectionEndpointClassicUpdate type CloudConnectionEndpointClassicUpdate struct { @@ -38,7 +40,6 @@ func (m *CloudConnectionEndpointClassicUpdate) Validate(formats strfmt.Registry) } func (m *CloudConnectionEndpointClassicUpdate) validateGre(formats strfmt.Registry) error { - if swag.IsZero(m.Gre) { // not required return nil } @@ -47,6 +48,38 @@ func (m *CloudConnectionEndpointClassicUpdate) validateGre(formats strfmt.Regist if err := m.Gre.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("gre") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("gre") + } + return err + } + } + + return nil +} + +// ContextValidate validate this cloud connection endpoint classic update based on the context it is used +func (m *CloudConnectionEndpointClassicUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateGre(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudConnectionEndpointClassicUpdate) contextValidateGre(ctx context.Context, formats strfmt.Registry) error { + + if m.Gre != nil { + if err := m.Gre.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gre") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("gre") } return err } diff --git a/power/models/cloud_connection_endpoint_v_p_c.go b/power/models/cloud_connection_endpoint_v_p_c.go index 7e71e2cd..873c365c 100644 --- a/power/models/cloud_connection_endpoint_v_p_c.go +++ b/power/models/cloud_connection_endpoint_v_p_c.go @@ -6,15 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // CloudConnectionEndpointVPC cloud connection endpoint v p c +// // swagger:model CloudConnectionEndpointVPC type CloudConnectionEndpointVPC struct { @@ -40,7 +41,6 @@ func (m *CloudConnectionEndpointVPC) Validate(formats strfmt.Registry) error { } func (m *CloudConnectionEndpointVPC) validateVpcs(formats strfmt.Registry) error { - if swag.IsZero(m.Vpcs) { // not required return nil } @@ -54,6 +54,42 @@ func (m *CloudConnectionEndpointVPC) validateVpcs(formats strfmt.Registry) error if err := m.Vpcs[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("vpcs" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vpcs" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this cloud connection endpoint v p c based on the context it is used +func (m *CloudConnectionEndpointVPC) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateVpcs(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudConnectionEndpointVPC) contextValidateVpcs(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Vpcs); i++ { + + if m.Vpcs[i] != nil { + if err := m.Vpcs[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vpcs" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vpcs" + "." + strconv.Itoa(i)) } return err } diff --git a/power/models/cloud_connection_g_r_e_tunnel.go b/power/models/cloud_connection_g_r_e_tunnel.go index 8a41269b..df506624 100644 --- a/power/models/cloud_connection_g_r_e_tunnel.go +++ b/power/models/cloud_connection_g_r_e_tunnel.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // CloudConnectionGRETunnel cloud connection g r e tunnel +// // swagger:model CloudConnectionGRETunnel type CloudConnectionGRETunnel struct { @@ -62,6 +64,11 @@ func (m *CloudConnectionGRETunnel) validateSourceIPAddress(formats strfmt.Regist return nil } +// ContextValidate validates this cloud connection g r e tunnel based on context it is used +func (m *CloudConnectionGRETunnel) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *CloudConnectionGRETunnel) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/cloud_connection_g_r_e_tunnel_create.go b/power/models/cloud_connection_g_r_e_tunnel_create.go index 7ad4526c..3310bc05 100644 --- a/power/models/cloud_connection_g_r_e_tunnel_create.go +++ b/power/models/cloud_connection_g_r_e_tunnel_create.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // CloudConnectionGRETunnelCreate cloud connection g r e tunnel create +// // swagger:model CloudConnectionGRETunnelCreate type CloudConnectionGRETunnelCreate struct { @@ -62,6 +64,11 @@ func (m *CloudConnectionGRETunnelCreate) validateDestIPAddress(formats strfmt.Re return nil } +// ContextValidate validates this cloud connection g r e tunnel create based on context it is used +func (m *CloudConnectionGRETunnelCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *CloudConnectionGRETunnelCreate) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/cloud_connection_update.go b/power/models/cloud_connection_update.go index bcb42880..df7e0c30 100644 --- a/power/models/cloud_connection_update.go +++ b/power/models/cloud_connection_update.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // CloudConnectionUpdate cloud connection update +// // swagger:model CloudConnectionUpdate type CloudConnectionUpdate struct { @@ -62,7 +63,6 @@ func (m *CloudConnectionUpdate) Validate(formats strfmt.Registry) error { } func (m *CloudConnectionUpdate) validateClassic(formats strfmt.Registry) error { - if swag.IsZero(m.Classic) { // not required return nil } @@ -71,6 +71,8 @@ func (m *CloudConnectionUpdate) validateClassic(formats strfmt.Registry) error { if err := m.Classic.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("classic") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("classic") } return err } @@ -93,14 +95,13 @@ func init() { // prop value enum func (m *CloudConnectionUpdate) validateSpeedEnum(path, location string, value int64) error { - if err := validate.Enum(path, location, value, cloudConnectionUpdateTypeSpeedPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, cloudConnectionUpdateTypeSpeedPropEnum, true); err != nil { return err } return nil } func (m *CloudConnectionUpdate) validateSpeed(formats strfmt.Registry) error { - if swag.IsZero(m.Speed) { // not required return nil } @@ -114,7 +115,6 @@ func (m *CloudConnectionUpdate) validateSpeed(formats strfmt.Registry) error { } func (m *CloudConnectionUpdate) validateVpc(formats strfmt.Registry) error { - if swag.IsZero(m.Vpc) { // not required return nil } @@ -123,6 +123,58 @@ func (m *CloudConnectionUpdate) validateVpc(formats strfmt.Registry) error { if err := m.Vpc.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("vpc") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vpc") + } + return err + } + } + + return nil +} + +// ContextValidate validate this cloud connection update based on the context it is used +func (m *CloudConnectionUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateClassic(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateVpc(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudConnectionUpdate) contextValidateClassic(ctx context.Context, formats strfmt.Registry) error { + + if m.Classic != nil { + if err := m.Classic.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("classic") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("classic") + } + return err + } + } + + return nil +} + +func (m *CloudConnectionUpdate) contextValidateVpc(ctx context.Context, formats strfmt.Registry) error { + + if m.Vpc != nil { + if err := m.Vpc.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vpc") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vpc") } return err } diff --git a/power/models/cloud_connection_v_p_c.go b/power/models/cloud_connection_v_p_c.go index a59b1740..7aab62b3 100644 --- a/power/models/cloud_connection_v_p_c.go +++ b/power/models/cloud_connection_v_p_c.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // CloudConnectionVPC cloud connection v p c +// // swagger:model CloudConnectionVPC type CloudConnectionVPC struct { @@ -48,6 +50,11 @@ func (m *CloudConnectionVPC) validateVpcID(formats strfmt.Registry) error { return nil } +// ContextValidate validates this cloud connection v p c based on context it is used +func (m *CloudConnectionVPC) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *CloudConnectionVPC) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/cloud_connection_virtual_private_clouds.go b/power/models/cloud_connection_virtual_private_clouds.go index edd49910..5c97aab8 100644 --- a/power/models/cloud_connection_virtual_private_clouds.go +++ b/power/models/cloud_connection_virtual_private_clouds.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // CloudConnectionVirtualPrivateClouds cloud connection virtual private clouds +// // swagger:model CloudConnectionVirtualPrivateClouds type CloudConnectionVirtualPrivateClouds struct { @@ -53,6 +54,42 @@ func (m *CloudConnectionVirtualPrivateClouds) validateVirtualPrivateClouds(forma if err := m.VirtualPrivateClouds[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("virtualPrivateClouds" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("virtualPrivateClouds" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this cloud connection virtual private clouds based on the context it is used +func (m *CloudConnectionVirtualPrivateClouds) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateVirtualPrivateClouds(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudConnectionVirtualPrivateClouds) contextValidateVirtualPrivateClouds(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.VirtualPrivateClouds); i++ { + + if m.VirtualPrivateClouds[i] != nil { + if err := m.VirtualPrivateClouds[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("virtualPrivateClouds" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("virtualPrivateClouds" + "." + strconv.Itoa(i)) } return err } @@ -82,6 +119,7 @@ func (m *CloudConnectionVirtualPrivateClouds) UnmarshalBinary(b []byte) error { } // CloudConnectionVirtualPrivateCloud cloud connection virtual private cloud +// // swagger:model CloudConnectionVirtualPrivateCloud type CloudConnectionVirtualPrivateCloud struct { @@ -164,6 +202,11 @@ func (m *CloudConnectionVirtualPrivateCloud) validateVpcID(formats strfmt.Regist return nil } +// ContextValidate validates this cloud connection virtual private cloud based on context it is used +func (m *CloudConnectionVirtualPrivateCloud) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *CloudConnectionVirtualPrivateCloud) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/cloud_connections.go b/power/models/cloud_connections.go index a573bc3f..1c9696c6 100644 --- a/power/models/cloud_connections.go +++ b/power/models/cloud_connections.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // CloudConnections cloud connections +// // swagger:model CloudConnections type CloudConnections struct { @@ -53,6 +54,42 @@ func (m *CloudConnections) validateCloudConnections(formats strfmt.Registry) err if err := m.CloudConnections[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("cloudConnections" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("cloudConnections" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this cloud connections based on the context it is used +func (m *CloudConnections) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCloudConnections(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudConnections) contextValidateCloudConnections(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.CloudConnections); i++ { + + if m.CloudConnections[i] != nil { + if err := m.CloudConnections[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cloudConnections" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("cloudConnections" + "." + strconv.Itoa(i)) } return err } diff --git a/power/models/cloud_instance.go b/power/models/cloud_instance.go index fd31ec24..307eab24 100644 --- a/power/models/cloud_instance.go +++ b/power/models/cloud_instance.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // CloudInstance cloud instance +// // swagger:model CloudInstance type CloudInstance struct { @@ -150,6 +151,8 @@ func (m *CloudInstance) validateLimits(formats strfmt.Registry) error { if err := m.Limits.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("limits") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("limits") } return err } @@ -191,6 +194,8 @@ func (m *CloudInstance) validatePvmInstances(formats strfmt.Registry) error { if err := m.PvmInstances[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("pvmInstances" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("pvmInstances" + "." + strconv.Itoa(i)) } return err } @@ -229,6 +234,82 @@ func (m *CloudInstance) validateUsage(formats strfmt.Registry) error { if err := m.Usage.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("usage") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("usage") + } + return err + } + } + + return nil +} + +// ContextValidate validate this cloud instance based on the context it is used +func (m *CloudInstance) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateLimits(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePvmInstances(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUsage(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudInstance) contextValidateLimits(ctx context.Context, formats strfmt.Registry) error { + + if m.Limits != nil { + if err := m.Limits.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("limits") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("limits") + } + return err + } + } + + return nil +} + +func (m *CloudInstance) contextValidatePvmInstances(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.PvmInstances); i++ { + + if m.PvmInstances[i] != nil { + if err := m.PvmInstances[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pvmInstances" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("pvmInstances" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CloudInstance) contextValidateUsage(ctx context.Context, formats strfmt.Registry) error { + + if m.Usage != nil { + if err := m.Usage.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("usage") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("usage") } return err } diff --git a/power/models/cloud_instance_create.go b/power/models/cloud_instance_create.go index ac335500..a94ca580 100644 --- a/power/models/cloud_instance_create.go +++ b/power/models/cloud_instance_create.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // CloudInstanceCreate cloud instance create +// // swagger:model CloudInstanceCreate type CloudInstanceCreate struct { @@ -119,6 +121,11 @@ func (m *CloudInstanceCreate) validateTenantID(formats strfmt.Registry) error { return nil } +// ContextValidate validates this cloud instance create based on context it is used +func (m *CloudInstanceCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *CloudInstanceCreate) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/cloud_instance_reference.go b/power/models/cloud_instance_reference.go index e5ef396e..22901098 100644 --- a/power/models/cloud_instance_reference.go +++ b/power/models/cloud_instance_reference.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // CloudInstanceReference cloud instance reference +// // swagger:model CloudInstanceReference type CloudInstanceReference struct { @@ -133,6 +135,8 @@ func (m *CloudInstanceReference) validateLimits(formats strfmt.Registry) error { if err := m.Limits.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("limits") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("limits") } return err } @@ -159,6 +163,36 @@ func (m *CloudInstanceReference) validateRegion(formats strfmt.Registry) error { return nil } +// ContextValidate validate this cloud instance reference based on the context it is used +func (m *CloudInstanceReference) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateLimits(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudInstanceReference) contextValidateLimits(ctx context.Context, formats strfmt.Registry) error { + + if m.Limits != nil { + if err := m.Limits.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("limits") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("limits") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *CloudInstanceReference) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/cloud_instance_update.go b/power/models/cloud_instance_update.go index 2b244aad..a22c0677 100644 --- a/power/models/cloud_instance_update.go +++ b/power/models/cloud_instance_update.go @@ -6,12 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // CloudInstanceUpdate cloud instance update +// // swagger:model CloudInstanceUpdate type CloudInstanceUpdate struct { @@ -36,6 +38,11 @@ func (m *CloudInstanceUpdate) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this cloud instance update based on context it is used +func (m *CloudInstanceUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *CloudInstanceUpdate) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/cloud_instance_usage_limits.go b/power/models/cloud_instance_usage_limits.go index c3a158a8..ab8710d9 100644 --- a/power/models/cloud_instance_usage_limits.go +++ b/power/models/cloud_instance_usage_limits.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // CloudInstanceUsageLimits cloud instance usage limits +// // swagger:model CloudInstanceUsageLimits type CloudInstanceUsageLimits struct { @@ -131,6 +133,11 @@ func (m *CloudInstanceUsageLimits) validateStorage(formats strfmt.Registry) erro return nil } +// ContextValidate validates this cloud instance usage limits based on context it is used +func (m *CloudInstanceUsageLimits) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *CloudInstanceUsageLimits) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/console_language.go b/power/models/console_language.go index 56de8ed3..76399a99 100644 --- a/power/models/console_language.go +++ b/power/models/console_language.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // ConsoleLanguage console language +// // swagger:model ConsoleLanguage type ConsoleLanguage struct { @@ -48,6 +50,11 @@ func (m *ConsoleLanguage) validateCode(formats strfmt.Registry) error { return nil } +// ContextValidate validates this console language based on context it is used +func (m *ConsoleLanguage) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ConsoleLanguage) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/console_languages.go b/power/models/console_languages.go index ebfa501a..adfe7d65 100644 --- a/power/models/console_languages.go +++ b/power/models/console_languages.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // ConsoleLanguages console languages +// // swagger:model ConsoleLanguages type ConsoleLanguages struct { @@ -53,6 +54,42 @@ func (m *ConsoleLanguages) validateConsoleLanguages(formats strfmt.Registry) err if err := m.ConsoleLanguages[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("consoleLanguages" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("consoleLanguages" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this console languages based on the context it is used +func (m *ConsoleLanguages) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateConsoleLanguages(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ConsoleLanguages) contextValidateConsoleLanguages(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.ConsoleLanguages); i++ { + + if m.ConsoleLanguages[i] != nil { + if err := m.ConsoleLanguages[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("consoleLanguages" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("consoleLanguages" + "." + strconv.Itoa(i)) } return err } diff --git a/power/models/context.go b/power/models/context.go index 63103fe1..85e1cd01 100644 --- a/power/models/context.go +++ b/power/models/context.go @@ -6,5 +6,6 @@ package models // Editing this file might prove futile when you re-run the swagger generate command // Context See [Context Conventions](https://github.com/openservicebrokerapi/servicebroker/blob/master/profile.md#context-object) for more details. +// // swagger:model Context type Context interface{} diff --git a/power/models/create_cos_image_import_job.go b/power/models/create_cos_image_import_job.go index dad3ac89..164c9a5a 100644 --- a/power/models/create_cos_image_import_job.go +++ b/power/models/create_cos_image_import_job.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // CreateCosImageImportJob create cos image import job +// // swagger:model CreateCosImageImportJob type CreateCosImageImportJob struct { @@ -120,14 +121,13 @@ const ( // prop value enum func (m *CreateCosImageImportJob) validateBucketAccessEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, createCosImageImportJobTypeBucketAccessPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, createCosImageImportJobTypeBucketAccessPropEnum, true); err != nil { return err } return nil } func (m *CreateCosImageImportJob) validateBucketAccess(formats strfmt.Registry) error { - if swag.IsZero(m.BucketAccess) { // not required return nil } @@ -196,14 +196,13 @@ const ( // prop value enum func (m *CreateCosImageImportJob) validateOsTypeEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, createCosImageImportJobTypeOsTypePropEnum); err != nil { + if err := validate.EnumCase(path, location, value, createCosImageImportJobTypeOsTypePropEnum, true); err != nil { return err } return nil } func (m *CreateCosImageImportJob) validateOsType(formats strfmt.Registry) error { - if swag.IsZero(m.OsType) { // not required return nil } @@ -226,7 +225,6 @@ func (m *CreateCosImageImportJob) validateRegion(formats strfmt.Registry) error } func (m *CreateCosImageImportJob) validateStorageAffinity(formats strfmt.Registry) error { - if swag.IsZero(m.StorageAffinity) { // not required return nil } @@ -235,6 +233,38 @@ func (m *CreateCosImageImportJob) validateStorageAffinity(formats strfmt.Registr if err := m.StorageAffinity.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("storageAffinity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("storageAffinity") + } + return err + } + } + + return nil +} + +// ContextValidate validate this create cos image import job based on the context it is used +func (m *CreateCosImageImportJob) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateStorageAffinity(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CreateCosImageImportJob) contextValidateStorageAffinity(ctx context.Context, formats strfmt.Registry) error { + + if m.StorageAffinity != nil { + if err := m.StorageAffinity.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("storageAffinity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("storageAffinity") } return err } diff --git a/power/models/create_data_volume.go b/power/models/create_data_volume.go index ee513257..77dd2e4b 100644 --- a/power/models/create_data_volume.go +++ b/power/models/create_data_volume.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // CreateDataVolume create data volume +// // swagger:model CreateDataVolume type CreateDataVolume struct { @@ -95,20 +96,19 @@ const ( // CreateDataVolumeAffinityPolicyAffinity captures enum value "affinity" CreateDataVolumeAffinityPolicyAffinity string = "affinity" - // CreateDataVolumeAffinityPolicyAntiAffinity captures enum value "anti-affinity" - CreateDataVolumeAffinityPolicyAntiAffinity string = "anti-affinity" + // CreateDataVolumeAffinityPolicyAntiDashAffinity captures enum value "anti-affinity" + CreateDataVolumeAffinityPolicyAntiDashAffinity string = "anti-affinity" ) // prop value enum func (m *CreateDataVolume) validateAffinityPolicyEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, createDataVolumeTypeAffinityPolicyPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, createDataVolumeTypeAffinityPolicyPropEnum, true); err != nil { return err } return nil } func (m *CreateDataVolume) validateAffinityPolicy(formats strfmt.Registry) error { - if swag.IsZero(m.AffinityPolicy) { // not required return nil } @@ -139,6 +139,11 @@ func (m *CreateDataVolume) validateSize(formats strfmt.Registry) error { return nil } +// ContextValidate validates this create data volume based on context it is used +func (m *CreateDataVolume) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *CreateDataVolume) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/create_image.go b/power/models/create_image.go index 74bfe1dd..b55fb483 100644 --- a/power/models/create_image.go +++ b/power/models/create_image.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // CreateImage create image +// // swagger:model CreateImage type CreateImage struct { @@ -113,14 +114,13 @@ const ( // prop value enum func (m *CreateImage) validateOsTypeEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, createImageTypeOsTypePropEnum); err != nil { + if err := validate.EnumCase(path, location, value, createImageTypeOsTypePropEnum, true); err != nil { return err } return nil } func (m *CreateImage) validateOsType(formats strfmt.Registry) error { - if swag.IsZero(m.OsType) { // not required return nil } @@ -147,8 +147,8 @@ func init() { const ( - // CreateImageSourceRootProject captures enum value "root-project" - CreateImageSourceRootProject string = "root-project" + // CreateImageSourceRootDashProject captures enum value "root-project" + CreateImageSourceRootDashProject string = "root-project" // CreateImageSourceURL captures enum value "url" CreateImageSourceURL string = "url" @@ -156,7 +156,7 @@ const ( // prop value enum func (m *CreateImage) validateSourceEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, createImageTypeSourcePropEnum); err != nil { + if err := validate.EnumCase(path, location, value, createImageTypeSourcePropEnum, true); err != nil { return err } return nil @@ -177,7 +177,6 @@ func (m *CreateImage) validateSource(formats strfmt.Registry) error { } func (m *CreateImage) validateStorageAffinity(formats strfmt.Registry) error { - if swag.IsZero(m.StorageAffinity) { // not required return nil } @@ -186,6 +185,38 @@ func (m *CreateImage) validateStorageAffinity(formats strfmt.Registry) error { if err := m.StorageAffinity.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("storageAffinity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("storageAffinity") + } + return err + } + } + + return nil +} + +// ContextValidate validate this create image based on the context it is used +func (m *CreateImage) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateStorageAffinity(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CreateImage) contextValidateStorageAffinity(ctx context.Context, formats strfmt.Registry) error { + + if m.StorageAffinity != nil { + if err := m.StorageAffinity.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("storageAffinity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("storageAffinity") } return err } diff --git a/power/models/d_h_c_p_server.go b/power/models/d_h_c_p_server.go index 87861aa5..5602d9d0 100644 --- a/power/models/d_h_c_p_server.go +++ b/power/models/d_h_c_p_server.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // DHCPServer d h c p server +// // swagger:model DHCPServer type DHCPServer struct { @@ -71,6 +73,8 @@ func (m *DHCPServer) validateNetwork(formats strfmt.Registry) error { if err := m.Network.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("network") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("network") } return err } @@ -88,6 +92,36 @@ func (m *DHCPServer) validateStatus(formats strfmt.Registry) error { return nil } +// ContextValidate validate this d h c p server based on the context it is used +func (m *DHCPServer) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateNetwork(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DHCPServer) contextValidateNetwork(ctx context.Context, formats strfmt.Registry) error { + + if m.Network != nil { + if err := m.Network.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("network") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("network") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *DHCPServer) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/d_h_c_p_server_detail.go b/power/models/d_h_c_p_server_detail.go index 0e0d5bb3..fc6284ff 100644 --- a/power/models/d_h_c_p_server_detail.go +++ b/power/models/d_h_c_p_server_detail.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // DHCPServerDetail d h c p server detail +// // swagger:model DHCPServerDetail type DHCPServerDetail struct { @@ -71,7 +72,6 @@ func (m *DHCPServerDetail) validateID(formats strfmt.Registry) error { } func (m *DHCPServerDetail) validateLeases(formats strfmt.Registry) error { - if swag.IsZero(m.Leases) { // not required return nil } @@ -85,6 +85,8 @@ func (m *DHCPServerDetail) validateLeases(formats strfmt.Registry) error { if err := m.Leases[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("leases" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("leases" + "." + strconv.Itoa(i)) } return err } @@ -105,6 +107,8 @@ func (m *DHCPServerDetail) validateNetwork(formats strfmt.Registry) error { if err := m.Network.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("network") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("network") } return err } @@ -122,6 +126,60 @@ func (m *DHCPServerDetail) validateStatus(formats strfmt.Registry) error { return nil } +// ContextValidate validate this d h c p server detail based on the context it is used +func (m *DHCPServerDetail) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateLeases(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateNetwork(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DHCPServerDetail) contextValidateLeases(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Leases); i++ { + + if m.Leases[i] != nil { + if err := m.Leases[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("leases" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("leases" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *DHCPServerDetail) contextValidateNetwork(ctx context.Context, formats strfmt.Registry) error { + + if m.Network != nil { + if err := m.Network.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("network") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("network") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *DHCPServerDetail) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/d_h_c_p_server_leases.go b/power/models/d_h_c_p_server_leases.go index b5c5d085..c2b6d338 100644 --- a/power/models/d_h_c_p_server_leases.go +++ b/power/models/d_h_c_p_server_leases.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // DHCPServerLeases d h c p server leases +// // swagger:model DHCPServerLeases type DHCPServerLeases struct { @@ -62,6 +64,11 @@ func (m *DHCPServerLeases) validateInstanceMacAddress(formats strfmt.Registry) e return nil } +// ContextValidate validates this d h c p server leases based on context it is used +func (m *DHCPServerLeases) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *DHCPServerLeases) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/d_h_c_p_server_network.go b/power/models/d_h_c_p_server_network.go index 68f766c9..52e05233 100644 --- a/power/models/d_h_c_p_server_network.go +++ b/power/models/d_h_c_p_server_network.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // DHCPServerNetwork d h c p server network +// // swagger:model DHCPServerNetwork type DHCPServerNetwork struct { @@ -62,6 +64,11 @@ func (m *DHCPServerNetwork) validateName(formats strfmt.Registry) error { return nil } +// ContextValidate validates this d h c p server network based on context it is used +func (m *DHCPServerNetwork) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *DHCPServerNetwork) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/d_h_c_p_servers.go b/power/models/d_h_c_p_servers.go index 123c30f8..947db73c 100644 --- a/power/models/d_h_c_p_servers.go +++ b/power/models/d_h_c_p_servers.go @@ -6,15 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // DHCPServers The list of DHCP Servers +// // swagger:model DHCPServers type DHCPServers []*DHCPServer @@ -31,6 +32,33 @@ func (m DHCPServers) Validate(formats strfmt.Registry) error { if err := m[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName(strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validate this d h c p servers based on the context it is used +func (m DHCPServers) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + + if m[i] != nil { + if err := m[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(strconv.Itoa(i)) } return err } diff --git a/power/models/dashboard_client.go b/power/models/dashboard_client.go index c993d3c9..bb752401 100644 --- a/power/models/dashboard_client.go +++ b/power/models/dashboard_client.go @@ -6,12 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // DashboardClient dashboard client +// // swagger:model DashboardClient type DashboardClient struct { @@ -30,6 +32,11 @@ func (m *DashboardClient) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this dashboard client based on context it is used +func (m *DashboardClient) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *DashboardClient) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/dead_peer_detection.go b/power/models/dead_peer_detection.go index cbc20ee7..89688eaa 100644 --- a/power/models/dead_peer_detection.go +++ b/power/models/dead_peer_detection.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // DeadPeerDetection Dead Peer Detection of the VPN Connection +// // swagger:model DeadPeerDetection type DeadPeerDetection struct { @@ -25,12 +26,14 @@ type DeadPeerDetection struct { Action *string `json:"action"` // How often to test that the Peer Gateway is responsive + // Example: 10 // Required: true // Maximum: 60 // Minimum: 2 Interval *int64 `json:"interval"` // The number of attempts to connect before tearing down the connection + // Example: 5 // Required: true // Maximum: 5 // Minimum: 1 @@ -79,7 +82,7 @@ const ( // prop value enum func (m *DeadPeerDetection) validateActionEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, deadPeerDetectionTypeActionPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, deadPeerDetectionTypeActionPropEnum, true); err != nil { return err } return nil @@ -105,11 +108,11 @@ func (m *DeadPeerDetection) validateInterval(formats strfmt.Registry) error { return err } - if err := validate.MinimumInt("interval", "body", int64(*m.Interval), 2, false); err != nil { + if err := validate.MinimumInt("interval", "body", *m.Interval, 2, false); err != nil { return err } - if err := validate.MaximumInt("interval", "body", int64(*m.Interval), 60, false); err != nil { + if err := validate.MaximumInt("interval", "body", *m.Interval, 60, false); err != nil { return err } @@ -122,17 +125,22 @@ func (m *DeadPeerDetection) validateThreshold(formats strfmt.Registry) error { return err } - if err := validate.MinimumInt("threshold", "body", int64(*m.Threshold), 1, false); err != nil { + if err := validate.MinimumInt("threshold", "body", *m.Threshold, 1, false); err != nil { return err } - if err := validate.MaximumInt("threshold", "body", int64(*m.Threshold), 5, false); err != nil { + if err := validate.MaximumInt("threshold", "body", *m.Threshold, 5, false); err != nil { return err } return nil } +// ContextValidate validates this dead peer detection based on context it is used +func (m *DeadPeerDetection) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *DeadPeerDetection) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/device_code.go b/power/models/device_code.go index a14fb20c..7cb9a748 100644 --- a/power/models/device_code.go +++ b/power/models/device_code.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // DeviceCode device code +// // swagger:model DeviceCode type DeviceCode struct { @@ -113,6 +115,11 @@ func (m *DeviceCode) validateVerificationURL(formats strfmt.Registry) error { return nil } +// ContextValidate validates this device code based on context it is used +func (m *DeviceCode) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *DeviceCode) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/error.go b/power/models/error.go index a4a74a0b..a7c90934 100644 --- a/power/models/error.go +++ b/power/models/error.go @@ -6,12 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // Error error +// // swagger:model Error type Error struct { @@ -33,6 +35,11 @@ func (m *Error) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this error based on context it is used +func (m *Error) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Error) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/event.go b/power/models/event.go index 74faa8a6..b9190c8f 100644 --- a/power/models/event.go +++ b/power/models/event.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Event event +// // swagger:model Event type Event struct { @@ -145,7 +146,7 @@ const ( // prop value enum func (m *Event) validateLevelEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, eventTypeLevelPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, eventTypeLevelPropEnum, true); err != nil { return err } return nil @@ -206,7 +207,6 @@ func (m *Event) validateTimestamp(formats strfmt.Registry) error { } func (m *Event) validateUser(formats strfmt.Registry) error { - if swag.IsZero(m.User) { // not required return nil } @@ -215,6 +215,38 @@ func (m *Event) validateUser(formats strfmt.Registry) error { if err := m.User.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("user") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("user") + } + return err + } + } + + return nil +} + +// ContextValidate validate this event based on the context it is used +func (m *Event) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateUser(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Event) contextValidateUser(ctx context.Context, formats strfmt.Registry) error { + + if m.User != nil { + if err := m.User.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("user") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("user") } return err } diff --git a/power/models/event_user.go b/power/models/event_user.go index 4de9b694..a20b42b1 100644 --- a/power/models/event_user.go +++ b/power/models/event_user.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // EventUser event user +// // swagger:model EventUser type EventUser struct { @@ -51,6 +53,11 @@ func (m *EventUser) validateUserID(formats strfmt.Registry) error { return nil } +// ContextValidate validates this event user based on context it is used +func (m *EventUser) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *EventUser) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/events.go b/power/models/events.go index 6747b172..721b97fc 100644 --- a/power/models/events.go +++ b/power/models/events.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Events events +// // swagger:model Events type Events struct { @@ -53,6 +54,42 @@ func (m *Events) validateEvents(formats strfmt.Registry) error { if err := m.Events[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("events" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("events" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this events based on the context it is used +func (m *Events) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateEvents(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Events) contextValidateEvents(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Events); i++ { + + if m.Events[i] != nil { + if err := m.Events[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("events" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("events" + "." + strconv.Itoa(i)) } return err } diff --git a/power/models/export_image.go b/power/models/export_image.go index 594acbe8..1f8a17dd 100644 --- a/power/models/export_image.go +++ b/power/models/export_image.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // ExportImage export image +// // swagger:model ExportImage type ExportImage struct { @@ -68,6 +70,11 @@ func (m *ExportImage) validateBucketName(formats strfmt.Registry) error { return nil } +// ContextValidate validates this export image based on context it is used +func (m *ExportImage) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ExportImage) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/hardware_platform.go b/power/models/hardware_platform.go index 064fc18f..8c78c41f 100644 --- a/power/models/hardware_platform.go +++ b/power/models/hardware_platform.go @@ -6,15 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // HardwarePlatform Hardware platform detailing its limits and statistics +// // swagger:model HardwarePlatform type HardwarePlatform struct { @@ -55,7 +56,6 @@ func (m *HardwarePlatform) Validate(formats strfmt.Registry) error { } func (m *HardwarePlatform) validateHostsResources(formats strfmt.Registry) error { - if swag.IsZero(m.HostsResources) { // not required return nil } @@ -69,6 +69,42 @@ func (m *HardwarePlatform) validateHostsResources(formats strfmt.Registry) error if err := m.HostsResources[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("hostsResources" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("hostsResources" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this hardware platform based on the context it is used +func (m *HardwarePlatform) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateHostsResources(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HardwarePlatform) contextValidateHostsResources(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.HostsResources); i++ { + + if m.HostsResources[i] != nil { + if err := m.HostsResources[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("hostsResources" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("hostsResources" + "." + strconv.Itoa(i)) } return err } diff --git a/power/models/hardware_platforms.go b/power/models/hardware_platforms.go index fa3008ac..504f271b 100644 --- a/power/models/hardware_platforms.go +++ b/power/models/hardware_platforms.go @@ -6,13 +6,15 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/validate" ) // HardwarePlatforms A map of hardware platforms detailing their limits and statistics +// // swagger:model HardwarePlatforms type HardwarePlatforms map[string]HardwarePlatform @@ -38,3 +40,23 @@ func (m HardwarePlatforms) Validate(formats strfmt.Registry) error { } return nil } + +// ContextValidate validate this hardware platforms based on the context it is used +func (m HardwarePlatforms) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + for k := range m { + + if val, ok := m[k]; ok { + if err := val.ContextValidate(ctx, formats); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/models/health.go b/power/models/health.go index 4e02af8f..b94914a5 100644 --- a/power/models/health.go +++ b/power/models/health.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Health health +// // swagger:model Health type Health struct { @@ -45,6 +47,11 @@ func (m *Health) validateStatus(formats strfmt.Registry) error { return nil } +// ContextValidate validates this health based on context it is used +func (m *Health) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Health) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/host_info.go b/power/models/host_info.go index 16082117..ab262805 100644 --- a/power/models/host_info.go +++ b/power/models/host_info.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // HostInfo host info +// // swagger:model HostInfo type HostInfo struct { @@ -80,6 +81,8 @@ func (m *HostInfo) validateCores(formats strfmt.Registry) error { if err := m.Cores.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("cores") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("cores") } return err } @@ -116,6 +119,8 @@ func (m *HostInfo) validateMemory(formats strfmt.Registry) error { if err := m.Memory.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("memory") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("memory") } return err } @@ -139,6 +144,82 @@ func (m *HostInfo) validatePvmInstances(formats strfmt.Registry) error { if err := m.PvmInstances[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("pvmInstances" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("pvmInstances" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this host info based on the context it is used +func (m *HostInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCores(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMemory(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePvmInstances(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HostInfo) contextValidateCores(ctx context.Context, formats strfmt.Registry) error { + + if m.Cores != nil { + if err := m.Cores.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cores") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("cores") + } + return err + } + } + + return nil +} + +func (m *HostInfo) contextValidateMemory(ctx context.Context, formats strfmt.Registry) error { + + if m.Memory != nil { + if err := m.Memory.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("memory") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("memory") + } + return err + } + } + + return nil +} + +func (m *HostInfo) contextValidatePvmInstances(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.PvmInstances); i++ { + + if m.PvmInstances[i] != nil { + if err := m.PvmInstances[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pvmInstances" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("pvmInstances" + "." + strconv.Itoa(i)) } return err } diff --git a/power/models/host_p_vm_instance.go b/power/models/host_p_vm_instance.go index ee21b460..5a04d4fb 100644 --- a/power/models/host_p_vm_instance.go +++ b/power/models/host_p_vm_instance.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // HostPVMInstance A pvm instance on host +// // swagger:model HostPVMInstance type HostPVMInstance struct { @@ -95,6 +97,8 @@ func (m *HostPVMInstance) validateOwner(formats strfmt.Registry) error { if err := m.Owner.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("owner") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("owner") } return err } @@ -139,6 +143,36 @@ func (m *HostPVMInstance) validateTenantID(formats strfmt.Registry) error { return nil } +// ContextValidate validate this host p VM instance based on the context it is used +func (m *HostPVMInstance) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateOwner(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HostPVMInstance) contextValidateOwner(ctx context.Context, formats strfmt.Registry) error { + + if m.Owner != nil { + if err := m.Owner.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("owner") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("owner") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *HostPVMInstance) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/host_resource.go b/power/models/host_resource.go index 68cd69ab..aef626fb 100644 --- a/power/models/host_resource.go +++ b/power/models/host_resource.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // HostResource host resource +// // swagger:model HostResource type HostResource struct { @@ -79,6 +81,11 @@ func (m *HostResource) validateUsed(formats strfmt.Registry) error { return nil } +// ContextValidate validates this host resource based on context it is used +func (m *HostResource) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *HostResource) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/host_resources.go b/power/models/host_resources.go index 92c43fab..40b3b865 100644 --- a/power/models/host_resources.go +++ b/power/models/host_resources.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // HostResources host resources +// // swagger:model HostResources type HostResources struct { @@ -79,6 +81,11 @@ func (m *HostResources) validateMemory(formats strfmt.Registry) error { return nil } +// ContextValidate validates this host resources based on context it is used +func (m *HostResources) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *HostResources) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/i_k_e_policies.go b/power/models/i_k_e_policies.go index 3c47182e..5cfe23d7 100644 --- a/power/models/i_k_e_policies.go +++ b/power/models/i_k_e_policies.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // IKEPolicies i k e policies +// // swagger:model IKEPolicies type IKEPolicies struct { @@ -53,6 +54,42 @@ func (m *IKEPolicies) validateIkePolicies(formats strfmt.Registry) error { if err := m.IkePolicies[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("ikePolicies" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ikePolicies" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this i k e policies based on the context it is used +func (m *IKEPolicies) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateIkePolicies(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IKEPolicies) contextValidateIkePolicies(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.IkePolicies); i++ { + + if m.IkePolicies[i] != nil { + if err := m.IkePolicies[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ikePolicies" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ikePolicies" + "." + strconv.Itoa(i)) } return err } diff --git a/power/models/i_k_e_policy.go b/power/models/i_k_e_policy.go index af8873a0..8645d4a4 100644 --- a/power/models/i_k_e_policy.go +++ b/power/models/i_k_e_policy.go @@ -6,46 +6,52 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // IKEPolicy IKE Policy object +// // swagger:model IKEPolicy type IKEPolicy struct { // authentication // Required: true - Authentication IKEPolicyAuthentication `json:"authentication"` + Authentication *IKEPolicyAuthentication `json:"authentication"` // DH group of the IKE Policy + // Example: 19 // Required: true // Enum: [1 2 5 14 19 20 24] DhGroup *int64 `json:"dhGroup"` // encryption of the IKE Policy + // Example: 3des-cbc // Required: true // Enum: [3des-cbc aes-128-cbc aes-128-gcm aes-192-cbc aes-256-cbc aes-256-gcm des-cbc] Encryption *string `json:"encryption"` // unique identifier of the IKE Policy object + // Example: 7edc8988-eb18-4b5c-a594-0d73d8254463 // Required: true ID *string `json:"id"` // key lifetime // Required: true - KeyLifetime KeyLifetime `json:"keyLifetime"` + KeyLifetime *KeyLifetime `json:"keyLifetime"` // name of the IKE Policy + // Example: ikePolicy1 // Required: true Name *string `json:"name"` // version of the IKE Policy + // Example: 2 // Required: true // Enum: [1 2] Version *int64 `json:"version"` @@ -91,13 +97,25 @@ func (m *IKEPolicy) Validate(formats strfmt.Registry) error { func (m *IKEPolicy) validateAuthentication(formats strfmt.Registry) error { - if err := m.Authentication.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("authentication") - } + if err := validate.Required("authentication", "body", m.Authentication); err != nil { + return err + } + + if err := validate.Required("authentication", "body", m.Authentication); err != nil { return err } + if m.Authentication != nil { + if err := m.Authentication.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("authentication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("authentication") + } + return err + } + } + return nil } @@ -115,7 +133,7 @@ func init() { // prop value enum func (m *IKEPolicy) validateDhGroupEnum(path, location string, value int64) error { - if err := validate.Enum(path, location, value, iKEPolicyTypeDhGroupPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, iKEPolicyTypeDhGroupPropEnum, true); err != nil { return err } return nil @@ -149,31 +167,31 @@ func init() { const ( - // IKEPolicyEncryptionNr3desCbc captures enum value "3des-cbc" - IKEPolicyEncryptionNr3desCbc string = "3des-cbc" + // IKEPolicyEncryptionNr3desDashCbc captures enum value "3des-cbc" + IKEPolicyEncryptionNr3desDashCbc string = "3des-cbc" - // IKEPolicyEncryptionAes128Cbc captures enum value "aes-128-cbc" - IKEPolicyEncryptionAes128Cbc string = "aes-128-cbc" + // IKEPolicyEncryptionAesDash128DashCbc captures enum value "aes-128-cbc" + IKEPolicyEncryptionAesDash128DashCbc string = "aes-128-cbc" - // IKEPolicyEncryptionAes128Gcm captures enum value "aes-128-gcm" - IKEPolicyEncryptionAes128Gcm string = "aes-128-gcm" + // IKEPolicyEncryptionAesDash128DashGcm captures enum value "aes-128-gcm" + IKEPolicyEncryptionAesDash128DashGcm string = "aes-128-gcm" - // IKEPolicyEncryptionAes192Cbc captures enum value "aes-192-cbc" - IKEPolicyEncryptionAes192Cbc string = "aes-192-cbc" + // IKEPolicyEncryptionAesDash192DashCbc captures enum value "aes-192-cbc" + IKEPolicyEncryptionAesDash192DashCbc string = "aes-192-cbc" - // IKEPolicyEncryptionAes256Cbc captures enum value "aes-256-cbc" - IKEPolicyEncryptionAes256Cbc string = "aes-256-cbc" + // IKEPolicyEncryptionAesDash256DashCbc captures enum value "aes-256-cbc" + IKEPolicyEncryptionAesDash256DashCbc string = "aes-256-cbc" - // IKEPolicyEncryptionAes256Gcm captures enum value "aes-256-gcm" - IKEPolicyEncryptionAes256Gcm string = "aes-256-gcm" + // IKEPolicyEncryptionAesDash256DashGcm captures enum value "aes-256-gcm" + IKEPolicyEncryptionAesDash256DashGcm string = "aes-256-gcm" - // IKEPolicyEncryptionDesCbc captures enum value "des-cbc" - IKEPolicyEncryptionDesCbc string = "des-cbc" + // IKEPolicyEncryptionDesDashCbc captures enum value "des-cbc" + IKEPolicyEncryptionDesDashCbc string = "des-cbc" ) // prop value enum func (m *IKEPolicy) validateEncryptionEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, iKEPolicyTypeEncryptionPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, iKEPolicyTypeEncryptionPropEnum, true); err != nil { return err } return nil @@ -204,13 +222,25 @@ func (m *IKEPolicy) validateID(formats strfmt.Registry) error { func (m *IKEPolicy) validateKeyLifetime(formats strfmt.Registry) error { - if err := m.KeyLifetime.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("keyLifetime") - } + if err := validate.Required("keyLifetime", "body", m.KeyLifetime); err != nil { + return err + } + + if err := validate.Required("keyLifetime", "body", m.KeyLifetime); err != nil { return err } + if m.KeyLifetime != nil { + if err := m.KeyLifetime.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keyLifetime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keyLifetime") + } + return err + } + } + return nil } @@ -237,7 +267,7 @@ func init() { // prop value enum func (m *IKEPolicy) validateVersionEnum(path, location string, value int64) error { - if err := validate.Enum(path, location, value, iKEPolicyTypeVersionPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, iKEPolicyTypeVersionPropEnum, true); err != nil { return err } return nil @@ -257,6 +287,56 @@ func (m *IKEPolicy) validateVersion(formats strfmt.Registry) error { return nil } +// ContextValidate validate this i k e policy based on the context it is used +func (m *IKEPolicy) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAuthentication(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateKeyLifetime(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IKEPolicy) contextValidateAuthentication(ctx context.Context, formats strfmt.Registry) error { + + if m.Authentication != nil { + if err := m.Authentication.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("authentication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("authentication") + } + return err + } + } + + return nil +} + +func (m *IKEPolicy) contextValidateKeyLifetime(ctx context.Context, formats strfmt.Registry) error { + + if m.KeyLifetime != nil { + if err := m.KeyLifetime.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keyLifetime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keyLifetime") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *IKEPolicy) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/i_k_e_policy_authentication.go b/power/models/i_k_e_policy_authentication.go index 07082dab..d1818168 100644 --- a/power/models/i_k_e_policy_authentication.go +++ b/power/models/i_k_e_policy_authentication.go @@ -6,28 +6,35 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/validate" ) // IKEPolicyAuthentication authentication of the IKE policy +// Example: sha1 +// // swagger:model IKEPolicyAuthentication type IKEPolicyAuthentication string +func NewIKEPolicyAuthentication(value IKEPolicyAuthentication) *IKEPolicyAuthentication { + v := value + return &v +} + const ( // IKEPolicyAuthenticationNone captures enum value "none" IKEPolicyAuthenticationNone IKEPolicyAuthentication = "none" - // IKEPolicyAuthenticationSha256 captures enum value "sha-256" - IKEPolicyAuthenticationSha256 IKEPolicyAuthentication = "sha-256" + // IKEPolicyAuthenticationShaDash256 captures enum value "sha-256" + IKEPolicyAuthenticationShaDash256 IKEPolicyAuthentication = "sha-256" - // IKEPolicyAuthenticationSha384 captures enum value "sha-384" - IKEPolicyAuthenticationSha384 IKEPolicyAuthentication = "sha-384" + // IKEPolicyAuthenticationShaDash384 captures enum value "sha-384" + IKEPolicyAuthenticationShaDash384 IKEPolicyAuthentication = "sha-384" // IKEPolicyAuthenticationSha1 captures enum value "sha1" IKEPolicyAuthenticationSha1 IKEPolicyAuthentication = "sha1" @@ -47,7 +54,7 @@ func init() { } func (m IKEPolicyAuthentication) validateIKEPolicyAuthenticationEnum(path, location string, value IKEPolicyAuthentication) error { - if err := validate.Enum(path, location, value, iKEPolicyAuthenticationEnum); err != nil { + if err := validate.EnumCase(path, location, value, iKEPolicyAuthenticationEnum, true); err != nil { return err } return nil @@ -67,3 +74,8 @@ func (m IKEPolicyAuthentication) Validate(formats strfmt.Registry) error { } return nil } + +// ContextValidate validates this i k e policy authentication based on context it is used +func (m IKEPolicyAuthentication) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/power/models/i_k_e_policy_authentications.go b/power/models/i_k_e_policy_authentications.go index 2fb44387..25b45ace 100644 --- a/power/models/i_k_e_policy_authentications.go +++ b/power/models/i_k_e_policy_authentications.go @@ -6,10 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + + "github.com/go-openapi/strfmt" ) // IKEPolicyAuthentications i k e policy authentications +// Example: ["none","sha-256","sha-384","sha1"] +// // swagger:model IKEPolicyAuthentications type IKEPolicyAuthentications []string @@ -17,3 +21,8 @@ type IKEPolicyAuthentications []string func (m IKEPolicyAuthentications) Validate(formats strfmt.Registry) error { return nil } + +// ContextValidate validates this i k e policy authentications based on context it is used +func (m IKEPolicyAuthentications) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/power/models/i_k_e_policy_create.go b/power/models/i_k_e_policy_create.go index ee2c97ae..d1714e69 100644 --- a/power/models/i_k_e_policy_create.go +++ b/power/models/i_k_e_policy_create.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // IKEPolicyCreate IKE Policy object used for creation +// // swagger:model IKEPolicyCreate type IKEPolicyCreate struct { @@ -23,20 +24,23 @@ type IKEPolicyCreate struct { Authentication IKEPolicyAuthentication `json:"authentication,omitempty"` // DH group of the IKE Policy + // Example: 19 // Required: true // Enum: [1 2 5 14 19 20 24] DhGroup *int64 `json:"dhGroup"` // encryption of the IKE Policy + // Example: 3des-cbc // Required: true // Enum: [3des-cbc aes-128-cbc aes-128-gcm aes-192-cbc aes-256-cbc aes-256-gcm des-cbc] Encryption *string `json:"encryption"` // key lifetime // Required: true - KeyLifetime KeyLifetime `json:"keyLifetime"` + KeyLifetime *KeyLifetime `json:"keyLifetime"` // name of the IKE Policy + // Example: ikePolicy1 // Required: true // Max Length: 47 // Min Length: 1 @@ -47,6 +51,7 @@ type IKEPolicyCreate struct { PresharedKey *string `json:"presharedKey"` // version of the IKE Policy + // Example: 2 // Required: true // Enum: [1 2] Version *int64 `json:"version"` @@ -91,7 +96,6 @@ func (m *IKEPolicyCreate) Validate(formats strfmt.Registry) error { } func (m *IKEPolicyCreate) validateAuthentication(formats strfmt.Registry) error { - if swag.IsZero(m.Authentication) { // not required return nil } @@ -99,6 +103,8 @@ func (m *IKEPolicyCreate) validateAuthentication(formats strfmt.Registry) error if err := m.Authentication.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("authentication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("authentication") } return err } @@ -120,7 +126,7 @@ func init() { // prop value enum func (m *IKEPolicyCreate) validateDhGroupEnum(path, location string, value int64) error { - if err := validate.Enum(path, location, value, iKEPolicyCreateTypeDhGroupPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, iKEPolicyCreateTypeDhGroupPropEnum, true); err != nil { return err } return nil @@ -154,31 +160,31 @@ func init() { const ( - // IKEPolicyCreateEncryptionNr3desCbc captures enum value "3des-cbc" - IKEPolicyCreateEncryptionNr3desCbc string = "3des-cbc" + // IKEPolicyCreateEncryptionNr3desDashCbc captures enum value "3des-cbc" + IKEPolicyCreateEncryptionNr3desDashCbc string = "3des-cbc" - // IKEPolicyCreateEncryptionAes128Cbc captures enum value "aes-128-cbc" - IKEPolicyCreateEncryptionAes128Cbc string = "aes-128-cbc" + // IKEPolicyCreateEncryptionAesDash128DashCbc captures enum value "aes-128-cbc" + IKEPolicyCreateEncryptionAesDash128DashCbc string = "aes-128-cbc" - // IKEPolicyCreateEncryptionAes128Gcm captures enum value "aes-128-gcm" - IKEPolicyCreateEncryptionAes128Gcm string = "aes-128-gcm" + // IKEPolicyCreateEncryptionAesDash128DashGcm captures enum value "aes-128-gcm" + IKEPolicyCreateEncryptionAesDash128DashGcm string = "aes-128-gcm" - // IKEPolicyCreateEncryptionAes192Cbc captures enum value "aes-192-cbc" - IKEPolicyCreateEncryptionAes192Cbc string = "aes-192-cbc" + // IKEPolicyCreateEncryptionAesDash192DashCbc captures enum value "aes-192-cbc" + IKEPolicyCreateEncryptionAesDash192DashCbc string = "aes-192-cbc" - // IKEPolicyCreateEncryptionAes256Cbc captures enum value "aes-256-cbc" - IKEPolicyCreateEncryptionAes256Cbc string = "aes-256-cbc" + // IKEPolicyCreateEncryptionAesDash256DashCbc captures enum value "aes-256-cbc" + IKEPolicyCreateEncryptionAesDash256DashCbc string = "aes-256-cbc" - // IKEPolicyCreateEncryptionAes256Gcm captures enum value "aes-256-gcm" - IKEPolicyCreateEncryptionAes256Gcm string = "aes-256-gcm" + // IKEPolicyCreateEncryptionAesDash256DashGcm captures enum value "aes-256-gcm" + IKEPolicyCreateEncryptionAesDash256DashGcm string = "aes-256-gcm" - // IKEPolicyCreateEncryptionDesCbc captures enum value "des-cbc" - IKEPolicyCreateEncryptionDesCbc string = "des-cbc" + // IKEPolicyCreateEncryptionDesDashCbc captures enum value "des-cbc" + IKEPolicyCreateEncryptionDesDashCbc string = "des-cbc" ) // prop value enum func (m *IKEPolicyCreate) validateEncryptionEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, iKEPolicyCreateTypeEncryptionPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, iKEPolicyCreateTypeEncryptionPropEnum, true); err != nil { return err } return nil @@ -200,13 +206,25 @@ func (m *IKEPolicyCreate) validateEncryption(formats strfmt.Registry) error { func (m *IKEPolicyCreate) validateKeyLifetime(formats strfmt.Registry) error { - if err := m.KeyLifetime.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("keyLifetime") - } + if err := validate.Required("keyLifetime", "body", m.KeyLifetime); err != nil { return err } + if err := validate.Required("keyLifetime", "body", m.KeyLifetime); err != nil { + return err + } + + if m.KeyLifetime != nil { + if err := m.KeyLifetime.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keyLifetime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keyLifetime") + } + return err + } + } + return nil } @@ -216,11 +234,11 @@ func (m *IKEPolicyCreate) validateName(formats strfmt.Registry) error { return err } - if err := validate.MinLength("name", "body", string(*m.Name), 1); err != nil { + if err := validate.MinLength("name", "body", *m.Name, 1); err != nil { return err } - if err := validate.MaxLength("name", "body", string(*m.Name), 47); err != nil { + if err := validate.MaxLength("name", "body", *m.Name, 47); err != nil { return err } @@ -250,7 +268,7 @@ func init() { // prop value enum func (m *IKEPolicyCreate) validateVersionEnum(path, location string, value int64) error { - if err := validate.Enum(path, location, value, iKEPolicyCreateTypeVersionPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, iKEPolicyCreateTypeVersionPropEnum, true); err != nil { return err } return nil @@ -270,6 +288,54 @@ func (m *IKEPolicyCreate) validateVersion(formats strfmt.Registry) error { return nil } +// ContextValidate validate this i k e policy create based on the context it is used +func (m *IKEPolicyCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAuthentication(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateKeyLifetime(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IKEPolicyCreate) contextValidateAuthentication(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Authentication.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("authentication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("authentication") + } + return err + } + + return nil +} + +func (m *IKEPolicyCreate) contextValidateKeyLifetime(ctx context.Context, formats strfmt.Registry) error { + + if m.KeyLifetime != nil { + if err := m.KeyLifetime.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keyLifetime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keyLifetime") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *IKEPolicyCreate) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/i_k_e_policy_dh_groups.go b/power/models/i_k_e_policy_dh_groups.go index 9810dd56..a41c32d0 100644 --- a/power/models/i_k_e_policy_dh_groups.go +++ b/power/models/i_k_e_policy_dh_groups.go @@ -6,10 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + + "github.com/go-openapi/strfmt" ) // IKEPolicyDhGroups i k e policy dh groups +// Example: [1,2,5,14,19,20,24] +// // swagger:model IKEPolicyDhGroups type IKEPolicyDhGroups []float64 @@ -17,3 +21,8 @@ type IKEPolicyDhGroups []float64 func (m IKEPolicyDhGroups) Validate(formats strfmt.Registry) error { return nil } + +// ContextValidate validates this i k e policy dh groups based on context it is used +func (m IKEPolicyDhGroups) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/power/models/i_k_e_policy_encryptions.go b/power/models/i_k_e_policy_encryptions.go index 2eac04c1..1c7b296c 100644 --- a/power/models/i_k_e_policy_encryptions.go +++ b/power/models/i_k_e_policy_encryptions.go @@ -6,10 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + + "github.com/go-openapi/strfmt" ) // IKEPolicyEncryptions i k e policy encryptions +// Example: ["3des-cbc","aes-128-cbc","aes-128-gcm","aes-192-cbc","aes-256-cbc","aes-256-gcm","des-cbc"] +// // swagger:model IKEPolicyEncryptions type IKEPolicyEncryptions []string @@ -17,3 +21,8 @@ type IKEPolicyEncryptions []string func (m IKEPolicyEncryptions) Validate(formats strfmt.Registry) error { return nil } + +// ContextValidate validates this i k e policy encryptions based on context it is used +func (m IKEPolicyEncryptions) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/power/models/i_k_e_policy_options.go b/power/models/i_k_e_policy_options.go index fa8dbf50..20103eec 100644 --- a/power/models/i_k_e_policy_options.go +++ b/power/models/i_k_e_policy_options.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // IKEPolicyOptions i k e policy options +// // swagger:model IKEPolicyOptions type IKEPolicyOptions struct { @@ -69,6 +71,8 @@ func (m *IKEPolicyOptions) validateAuthentications(formats strfmt.Registry) erro if err := m.Authentications.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("authentications") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("authentications") } return err } @@ -85,6 +89,8 @@ func (m *IKEPolicyOptions) validateDhGroups(formats strfmt.Registry) error { if err := m.DhGroups.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("dhGroups") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("dhGroups") } return err } @@ -101,6 +107,8 @@ func (m *IKEPolicyOptions) validateEncryptions(formats strfmt.Registry) error { if err := m.Encryptions.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("encryptions") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("encryptions") } return err } @@ -117,6 +125,90 @@ func (m *IKEPolicyOptions) validateVersions(formats strfmt.Registry) error { if err := m.Versions.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("versions") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("versions") + } + return err + } + + return nil +} + +// ContextValidate validate this i k e policy options based on the context it is used +func (m *IKEPolicyOptions) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAuthentications(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateDhGroups(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateEncryptions(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateVersions(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IKEPolicyOptions) contextValidateAuthentications(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Authentications.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("authentications") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("authentications") + } + return err + } + + return nil +} + +func (m *IKEPolicyOptions) contextValidateDhGroups(ctx context.Context, formats strfmt.Registry) error { + + if err := m.DhGroups.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("dhGroups") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("dhGroups") + } + return err + } + + return nil +} + +func (m *IKEPolicyOptions) contextValidateEncryptions(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Encryptions.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("encryptions") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("encryptions") + } + return err + } + + return nil +} + +func (m *IKEPolicyOptions) contextValidateVersions(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Versions.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("versions") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("versions") } return err } diff --git a/power/models/i_k_e_policy_ref.go b/power/models/i_k_e_policy_ref.go index c0b3e3df..4efb0751 100644 --- a/power/models/i_k_e_policy_ref.go +++ b/power/models/i_k_e_policy_ref.go @@ -6,22 +6,26 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // IKEPolicyRef IKE Policy reference object +// // swagger:model IKEPolicyRef type IKEPolicyRef struct { // unique identifier of IKE Policy + // Example: 6edc8988-ab18-4b5c-b123-0d73e8254463 // Required: true ID *string `json:"id"` // name of IKE Policy + // Example: IKE Policy 1 // Required: true Name *string `json:"name"` } @@ -62,6 +66,11 @@ func (m *IKEPolicyRef) validateName(formats strfmt.Registry) error { return nil } +// ContextValidate validates this i k e policy ref based on context it is used +func (m *IKEPolicyRef) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *IKEPolicyRef) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/i_k_e_policy_template.go b/power/models/i_k_e_policy_template.go index fba6a437..6a12b863 100644 --- a/power/models/i_k_e_policy_template.go +++ b/power/models/i_k_e_policy_template.go @@ -6,34 +6,40 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // IKEPolicyTemplate i k e policy template +// // swagger:model IKEPolicyTemplate type IKEPolicyTemplate struct { // ikePolicy Authentication default value + // Example: sha256 // Required: true Authentication *string `json:"authentication"` // ikePolicy DHGroup default value + // Example: 2 // Required: true DhGroup *int64 `json:"dhGroup"` // ikePolicy Encryption default value + // Example: 3des-cbc // Required: true Encryption *string `json:"encryption"` // key lifetime // Required: true - KeyLifetime KeyLifetime `json:"keyLifetime"` + KeyLifetime *KeyLifetime `json:"keyLifetime"` // ikePolicy Version default value + // Example: 1 // Required: true Version *float64 `json:"version"` } @@ -97,13 +103,25 @@ func (m *IKEPolicyTemplate) validateEncryption(formats strfmt.Registry) error { func (m *IKEPolicyTemplate) validateKeyLifetime(formats strfmt.Registry) error { - if err := m.KeyLifetime.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("keyLifetime") - } + if err := validate.Required("keyLifetime", "body", m.KeyLifetime); err != nil { + return err + } + + if err := validate.Required("keyLifetime", "body", m.KeyLifetime); err != nil { return err } + if m.KeyLifetime != nil { + if err := m.KeyLifetime.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keyLifetime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keyLifetime") + } + return err + } + } + return nil } @@ -116,6 +134,36 @@ func (m *IKEPolicyTemplate) validateVersion(formats strfmt.Registry) error { return nil } +// ContextValidate validate this i k e policy template based on the context it is used +func (m *IKEPolicyTemplate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateKeyLifetime(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IKEPolicyTemplate) contextValidateKeyLifetime(ctx context.Context, formats strfmt.Registry) error { + + if m.KeyLifetime != nil { + if err := m.KeyLifetime.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keyLifetime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keyLifetime") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *IKEPolicyTemplate) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/i_k_e_policy_update.go b/power/models/i_k_e_policy_update.go index ac8df053..013dadb0 100644 --- a/power/models/i_k_e_policy_update.go +++ b/power/models/i_k_e_policy_update.go @@ -6,16 +6,19 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // IKEPolicyUpdate IKE Policy object used for update +// +// Min Properties: 1 +// // swagger:model IKEPolicyUpdate type IKEPolicyUpdate struct { @@ -23,10 +26,12 @@ type IKEPolicyUpdate struct { Authentication IKEPolicyAuthentication `json:"authentication,omitempty"` // DH group of the IKE Policy + // Example: 19 // Enum: [1 2 5 14 19 20 24] DhGroup int64 `json:"dhGroup,omitempty"` // encryption of the IKE Policy + // Example: 3des-cbc // Enum: [3des-cbc aes-128-cbc aes-128-gcm aes-192-cbc aes-256-cbc aes-256-gcm des-cbc] Encryption string `json:"encryption,omitempty"` @@ -34,6 +39,7 @@ type IKEPolicyUpdate struct { KeyLifetime KeyLifetime `json:"keyLifetime,omitempty"` // name of the IKE Policy + // Example: ikePolicy1 // Max Length: 47 // Min Length: 1 Name string `json:"name,omitempty"` @@ -42,6 +48,7 @@ type IKEPolicyUpdate struct { PresharedKey string `json:"presharedKey,omitempty"` // version of the IKE Policy + // Example: 2 // Enum: [1 2] Version int64 `json:"version,omitempty"` @@ -58,10 +65,12 @@ func (m *IKEPolicyUpdate) UnmarshalJSON(data []byte) error { Authentication IKEPolicyAuthentication `json:"authentication,omitempty"` // DH group of the IKE Policy + // Example: 19 // Enum: [1 2 5 14 19 20 24] DhGroup int64 `json:"dhGroup,omitempty"` // encryption of the IKE Policy + // Example: 3des-cbc // Enum: [3des-cbc aes-128-cbc aes-128-gcm aes-192-cbc aes-256-cbc aes-256-gcm des-cbc] Encryption string `json:"encryption,omitempty"` @@ -69,6 +78,7 @@ func (m *IKEPolicyUpdate) UnmarshalJSON(data []byte) error { KeyLifetime KeyLifetime `json:"keyLifetime,omitempty"` // name of the IKE Policy + // Example: ikePolicy1 // Max Length: 47 // Min Length: 1 Name string `json:"name,omitempty"` @@ -77,6 +87,7 @@ func (m *IKEPolicyUpdate) UnmarshalJSON(data []byte) error { PresharedKey string `json:"presharedKey,omitempty"` // version of the IKE Policy + // Example: 2 // Enum: [1 2] Version int64 `json:"version,omitempty"` } @@ -86,19 +97,12 @@ func (m *IKEPolicyUpdate) UnmarshalJSON(data []byte) error { var rcv IKEPolicyUpdate rcv.Authentication = stage1.Authentication - rcv.DhGroup = stage1.DhGroup - rcv.Encryption = stage1.Encryption - rcv.KeyLifetime = stage1.KeyLifetime - rcv.Name = stage1.Name - rcv.PresharedKey = stage1.PresharedKey - rcv.Version = stage1.Version - *m = rcv // stage 2, remove properties and add to map @@ -108,19 +112,12 @@ func (m *IKEPolicyUpdate) UnmarshalJSON(data []byte) error { } delete(stage2, "authentication") - delete(stage2, "dhGroup") - delete(stage2, "encryption") - delete(stage2, "keyLifetime") - delete(stage2, "name") - delete(stage2, "presharedKey") - delete(stage2, "version") - // stage 3, add additional properties values if len(stage2) > 0 { result := make(map[string]interface{}) @@ -145,10 +142,12 @@ func (m IKEPolicyUpdate) MarshalJSON() ([]byte, error) { Authentication IKEPolicyAuthentication `json:"authentication,omitempty"` // DH group of the IKE Policy + // Example: 19 // Enum: [1 2 5 14 19 20 24] DhGroup int64 `json:"dhGroup,omitempty"` // encryption of the IKE Policy + // Example: 3des-cbc // Enum: [3des-cbc aes-128-cbc aes-128-gcm aes-192-cbc aes-256-cbc aes-256-gcm des-cbc] Encryption string `json:"encryption,omitempty"` @@ -156,6 +155,7 @@ func (m IKEPolicyUpdate) MarshalJSON() ([]byte, error) { KeyLifetime KeyLifetime `json:"keyLifetime,omitempty"` // name of the IKE Policy + // Example: ikePolicy1 // Max Length: 47 // Min Length: 1 Name string `json:"name,omitempty"` @@ -164,22 +164,17 @@ func (m IKEPolicyUpdate) MarshalJSON() ([]byte, error) { PresharedKey string `json:"presharedKey,omitempty"` // version of the IKE Policy + // Example: 2 // Enum: [1 2] Version int64 `json:"version,omitempty"` } stage1.Authentication = m.Authentication - stage1.DhGroup = m.DhGroup - stage1.Encryption = m.Encryption - stage1.KeyLifetime = m.KeyLifetime - stage1.Name = m.Name - stage1.PresharedKey = m.PresharedKey - stage1.Version = m.Version // make JSON object for known properties @@ -188,7 +183,7 @@ func (m IKEPolicyUpdate) MarshalJSON() ([]byte, error) { return nil, err } - if len(m.IKEPolicyUpdateAdditionalProperties) == 0 { + if len(m.IKEPolicyUpdateAdditionalProperties) == 0 { // no additional properties return props, nil } @@ -198,19 +193,40 @@ func (m IKEPolicyUpdate) MarshalJSON() ([]byte, error) { return nil, err } - if len(props) < 3 { + if len(props) < 3 { // "{}": only additional properties return additional, nil } // concatenate the 2 objects - props[len(props)-1] = ',' - return append(props, additional[1:]...), nil + return swag.ConcatJSON(props, additional), nil } // Validate validates this i k e policy update func (m *IKEPolicyUpdate) Validate(formats strfmt.Registry) error { var res []error + // short circuits minProperties > 0 + if m == nil { + return errors.TooFewProperties("", "body", 1) + } + + props := make(map[string]json.RawMessage, 7+10) + j, err := swag.WriteJSON(m) + if err != nil { + return err + } + + if err = swag.ReadJSON(j, &props); err != nil { + return err + } + + nprops := len(props) + + // minProperties: 1 + if nprops < 1 { + return errors.TooFewProperties("", "body", 1) + } + if err := m.validateAuthentication(formats); err != nil { res = append(res, err) } @@ -242,7 +258,6 @@ func (m *IKEPolicyUpdate) Validate(formats strfmt.Registry) error { } func (m *IKEPolicyUpdate) validateAuthentication(formats strfmt.Registry) error { - if swag.IsZero(m.Authentication) { // not required return nil } @@ -250,6 +265,8 @@ func (m *IKEPolicyUpdate) validateAuthentication(formats strfmt.Registry) error if err := m.Authentication.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("authentication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("authentication") } return err } @@ -271,14 +288,13 @@ func init() { // prop value enum func (m *IKEPolicyUpdate) validateDhGroupEnum(path, location string, value int64) error { - if err := validate.Enum(path, location, value, iKEPolicyUpdateTypeDhGroupPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, iKEPolicyUpdateTypeDhGroupPropEnum, true); err != nil { return err } return nil } func (m *IKEPolicyUpdate) validateDhGroup(formats strfmt.Registry) error { - if swag.IsZero(m.DhGroup) { // not required return nil } @@ -305,38 +321,37 @@ func init() { const ( - // IKEPolicyUpdateEncryptionNr3desCbc captures enum value "3des-cbc" - IKEPolicyUpdateEncryptionNr3desCbc string = "3des-cbc" + // IKEPolicyUpdateEncryptionNr3desDashCbc captures enum value "3des-cbc" + IKEPolicyUpdateEncryptionNr3desDashCbc string = "3des-cbc" - // IKEPolicyUpdateEncryptionAes128Cbc captures enum value "aes-128-cbc" - IKEPolicyUpdateEncryptionAes128Cbc string = "aes-128-cbc" + // IKEPolicyUpdateEncryptionAesDash128DashCbc captures enum value "aes-128-cbc" + IKEPolicyUpdateEncryptionAesDash128DashCbc string = "aes-128-cbc" - // IKEPolicyUpdateEncryptionAes128Gcm captures enum value "aes-128-gcm" - IKEPolicyUpdateEncryptionAes128Gcm string = "aes-128-gcm" + // IKEPolicyUpdateEncryptionAesDash128DashGcm captures enum value "aes-128-gcm" + IKEPolicyUpdateEncryptionAesDash128DashGcm string = "aes-128-gcm" - // IKEPolicyUpdateEncryptionAes192Cbc captures enum value "aes-192-cbc" - IKEPolicyUpdateEncryptionAes192Cbc string = "aes-192-cbc" + // IKEPolicyUpdateEncryptionAesDash192DashCbc captures enum value "aes-192-cbc" + IKEPolicyUpdateEncryptionAesDash192DashCbc string = "aes-192-cbc" - // IKEPolicyUpdateEncryptionAes256Cbc captures enum value "aes-256-cbc" - IKEPolicyUpdateEncryptionAes256Cbc string = "aes-256-cbc" + // IKEPolicyUpdateEncryptionAesDash256DashCbc captures enum value "aes-256-cbc" + IKEPolicyUpdateEncryptionAesDash256DashCbc string = "aes-256-cbc" - // IKEPolicyUpdateEncryptionAes256Gcm captures enum value "aes-256-gcm" - IKEPolicyUpdateEncryptionAes256Gcm string = "aes-256-gcm" + // IKEPolicyUpdateEncryptionAesDash256DashGcm captures enum value "aes-256-gcm" + IKEPolicyUpdateEncryptionAesDash256DashGcm string = "aes-256-gcm" - // IKEPolicyUpdateEncryptionDesCbc captures enum value "des-cbc" - IKEPolicyUpdateEncryptionDesCbc string = "des-cbc" + // IKEPolicyUpdateEncryptionDesDashCbc captures enum value "des-cbc" + IKEPolicyUpdateEncryptionDesDashCbc string = "des-cbc" ) // prop value enum func (m *IKEPolicyUpdate) validateEncryptionEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, iKEPolicyUpdateTypeEncryptionPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, iKEPolicyUpdateTypeEncryptionPropEnum, true); err != nil { return err } return nil } func (m *IKEPolicyUpdate) validateEncryption(formats strfmt.Registry) error { - if swag.IsZero(m.Encryption) { // not required return nil } @@ -350,7 +365,6 @@ func (m *IKEPolicyUpdate) validateEncryption(formats strfmt.Registry) error { } func (m *IKEPolicyUpdate) validateKeyLifetime(formats strfmt.Registry) error { - if swag.IsZero(m.KeyLifetime) { // not required return nil } @@ -358,6 +372,8 @@ func (m *IKEPolicyUpdate) validateKeyLifetime(formats strfmt.Registry) error { if err := m.KeyLifetime.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("keyLifetime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keyLifetime") } return err } @@ -366,16 +382,15 @@ func (m *IKEPolicyUpdate) validateKeyLifetime(formats strfmt.Registry) error { } func (m *IKEPolicyUpdate) validateName(formats strfmt.Registry) error { - if swag.IsZero(m.Name) { // not required return nil } - if err := validate.MinLength("name", "body", string(m.Name), 1); err != nil { + if err := validate.MinLength("name", "body", m.Name, 1); err != nil { return err } - if err := validate.MaxLength("name", "body", string(m.Name), 47); err != nil { + if err := validate.MaxLength("name", "body", m.Name, 47); err != nil { return err } @@ -396,14 +411,13 @@ func init() { // prop value enum func (m *IKEPolicyUpdate) validateVersionEnum(path, location string, value int64) error { - if err := validate.Enum(path, location, value, iKEPolicyUpdateTypeVersionPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, iKEPolicyUpdateTypeVersionPropEnum, true); err != nil { return err } return nil } func (m *IKEPolicyUpdate) validateVersion(formats strfmt.Registry) error { - if swag.IsZero(m.Version) { // not required return nil } @@ -416,6 +430,52 @@ func (m *IKEPolicyUpdate) validateVersion(formats strfmt.Registry) error { return nil } +// ContextValidate validate this i k e policy update based on the context it is used +func (m *IKEPolicyUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAuthentication(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateKeyLifetime(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IKEPolicyUpdate) contextValidateAuthentication(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Authentication.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("authentication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("authentication") + } + return err + } + + return nil +} + +func (m *IKEPolicyUpdate) contextValidateKeyLifetime(ctx context.Context, formats strfmt.Registry) error { + + if err := m.KeyLifetime.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keyLifetime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keyLifetime") + } + return err + } + + return nil +} + // MarshalBinary interface implementation func (m *IKEPolicyUpdate) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/image.go b/power/models/image.go index 149a46a8..1d79e34d 100644 --- a/power/models/image.go +++ b/power/models/image.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Image image +// // swagger:model Image type Image struct { @@ -172,7 +173,6 @@ func (m *Image) validateSize(formats strfmt.Registry) error { } func (m *Image) validateSpecifications(formats strfmt.Registry) error { - if swag.IsZero(m.Specifications) { // not required return nil } @@ -181,6 +181,8 @@ func (m *Image) validateSpecifications(formats strfmt.Registry) error { if err := m.Specifications.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("specifications") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("specifications") } return err } @@ -208,7 +210,6 @@ func (m *Image) validateStorageType(formats strfmt.Registry) error { } func (m *Image) validateTaskref(formats strfmt.Registry) error { - if swag.IsZero(m.Taskref) { // not required return nil } @@ -217,6 +218,8 @@ func (m *Image) validateTaskref(formats strfmt.Registry) error { if err := m.Taskref.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("taskref") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("taskref") } return err } @@ -226,7 +229,6 @@ func (m *Image) validateTaskref(formats strfmt.Registry) error { } func (m *Image) validateVolumes(formats strfmt.Registry) error { - if swag.IsZero(m.Volumes) { // not required return nil } @@ -240,6 +242,82 @@ func (m *Image) validateVolumes(formats strfmt.Registry) error { if err := m.Volumes[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("volumes" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("volumes" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this image based on the context it is used +func (m *Image) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateSpecifications(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTaskref(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateVolumes(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Image) contextValidateSpecifications(ctx context.Context, formats strfmt.Registry) error { + + if m.Specifications != nil { + if err := m.Specifications.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("specifications") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("specifications") + } + return err + } + } + + return nil +} + +func (m *Image) contextValidateTaskref(ctx context.Context, formats strfmt.Registry) error { + + if m.Taskref != nil { + if err := m.Taskref.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("taskref") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("taskref") + } + return err + } + } + + return nil +} + +func (m *Image) contextValidateVolumes(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Volumes); i++ { + + if m.Volumes[i] != nil { + if err := m.Volumes[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("volumes" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("volumes" + "." + strconv.Itoa(i)) } return err } diff --git a/power/models/image_reference.go b/power/models/image_reference.go index a13618ba..0d1fb25d 100644 --- a/power/models/image_reference.go +++ b/power/models/image_reference.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // ImageReference image reference +// // swagger:model ImageReference type ImageReference struct { @@ -182,6 +184,8 @@ func (m *ImageReference) validateSpecifications(formats strfmt.Registry) error { if err := m.Specifications.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("specifications") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("specifications") } return err } @@ -217,6 +221,36 @@ func (m *ImageReference) validateStorageType(formats strfmt.Registry) error { return nil } +// ContextValidate validate this image reference based on the context it is used +func (m *ImageReference) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateSpecifications(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ImageReference) contextValidateSpecifications(ctx context.Context, formats strfmt.Registry) error { + + if m.Specifications != nil { + if err := m.Specifications.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("specifications") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("specifications") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ImageReference) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/image_specifications.go b/power/models/image_specifications.go index 2f4639b5..d5f71a0e 100644 --- a/power/models/image_specifications.go +++ b/power/models/image_specifications.go @@ -6,12 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ImageSpecifications image specifications +// // swagger:model ImageSpecifications type ImageSpecifications struct { @@ -42,6 +44,11 @@ func (m *ImageSpecifications) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this image specifications based on context it is used +func (m *ImageSpecifications) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ImageSpecifications) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/image_volume.go b/power/models/image_volume.go index f419e7a4..44e1899d 100644 --- a/power/models/image_volume.go +++ b/power/models/image_volume.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // ImageVolume image volume +// // swagger:model ImageVolume type ImageVolume struct { @@ -96,6 +98,11 @@ func (m *ImageVolume) validateVolumeID(formats strfmt.Registry) error { return nil } +// ContextValidate validates this image volume based on context it is used +func (m *ImageVolume) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ImageVolume) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/images.go b/power/models/images.go index 3c355c49..b9c4473c 100644 --- a/power/models/images.go +++ b/power/models/images.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Images images +// // swagger:model Images type Images struct { @@ -53,6 +54,42 @@ func (m *Images) validateImages(formats strfmt.Registry) error { if err := m.Images[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("images" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("images" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this images based on the context it is used +func (m *Images) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateImages(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Images) contextValidateImages(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Images); i++ { + + if m.Images[i] != nil { + if err := m.Images[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("images" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("images" + "." + strconv.Itoa(i)) } return err } diff --git a/power/models/ip_address_range.go b/power/models/ip_address_range.go index b4961b41..58cbfff9 100644 --- a/power/models/ip_address_range.go +++ b/power/models/ip_address_range.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // IPAddressRange IP address range +// // swagger:model IPAddressRange type IPAddressRange struct { @@ -62,6 +64,11 @@ func (m *IPAddressRange) validateStartingIPAddress(formats strfmt.Registry) erro return nil } +// ContextValidate validates this IP address range based on context it is used +func (m *IPAddressRange) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *IPAddressRange) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/ip_s_e_c_policy_authentication.go b/power/models/ip_s_e_c_policy_authentication.go index bf10e6b7..77384db6 100644 --- a/power/models/ip_s_e_c_policy_authentication.go +++ b/power/models/ip_s_e_c_policy_authentication.go @@ -6,28 +6,35 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/validate" ) // IPSECPolicyAuthentication authentication for IPSec policy +// Example: hmac-md5-96 +// // swagger:model IPSECPolicyAuthentication type IPSECPolicyAuthentication string +func NewIPSECPolicyAuthentication(value IPSECPolicyAuthentication) *IPSECPolicyAuthentication { + v := value + return &v +} + const ( - // IPSECPolicyAuthenticationHmacMd596 captures enum value "hmac-md5-96" - IPSECPolicyAuthenticationHmacMd596 IPSECPolicyAuthentication = "hmac-md5-96" + // IPSECPolicyAuthenticationHmacDashMd5Dash96 captures enum value "hmac-md5-96" + IPSECPolicyAuthenticationHmacDashMd5Dash96 IPSECPolicyAuthentication = "hmac-md5-96" - // IPSECPolicyAuthenticationHmacSha256128 captures enum value "hmac-sha-256-128" - IPSECPolicyAuthenticationHmacSha256128 IPSECPolicyAuthentication = "hmac-sha-256-128" + // IPSECPolicyAuthenticationHmacDashShaDash256Dash128 captures enum value "hmac-sha-256-128" + IPSECPolicyAuthenticationHmacDashShaDash256Dash128 IPSECPolicyAuthentication = "hmac-sha-256-128" - // IPSECPolicyAuthenticationHmacSha196 captures enum value "hmac-sha1-96" - IPSECPolicyAuthenticationHmacSha196 IPSECPolicyAuthentication = "hmac-sha1-96" + // IPSECPolicyAuthenticationHmacDashSha1Dash96 captures enum value "hmac-sha1-96" + IPSECPolicyAuthenticationHmacDashSha1Dash96 IPSECPolicyAuthentication = "hmac-sha1-96" // IPSECPolicyAuthenticationNone captures enum value "none" IPSECPolicyAuthenticationNone IPSECPolicyAuthentication = "none" @@ -47,7 +54,7 @@ func init() { } func (m IPSECPolicyAuthentication) validateIPSECPolicyAuthenticationEnum(path, location string, value IPSECPolicyAuthentication) error { - if err := validate.Enum(path, location, value, ipSECPolicyAuthenticationEnum); err != nil { + if err := validate.EnumCase(path, location, value, ipSECPolicyAuthenticationEnum, true); err != nil { return err } return nil @@ -67,3 +74,8 @@ func (m IPSECPolicyAuthentication) Validate(formats strfmt.Registry) error { } return nil } + +// ContextValidate validates this IP s e c policy authentication based on context it is used +func (m IPSECPolicyAuthentication) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/power/models/ip_s_e_c_policy_authentications.go b/power/models/ip_s_e_c_policy_authentications.go index 0660c5a9..f7cf3199 100644 --- a/power/models/ip_s_e_c_policy_authentications.go +++ b/power/models/ip_s_e_c_policy_authentications.go @@ -6,10 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + + "github.com/go-openapi/strfmt" ) // IPSECPolicyAuthentications IP s e c policy authentications +// Example: ["hmac-md5-96","hmac-sha-256-128","hmac-sha1-96","none"] +// // swagger:model IPSECPolicyAuthentications type IPSECPolicyAuthentications []string @@ -17,3 +21,8 @@ type IPSECPolicyAuthentications []string func (m IPSECPolicyAuthentications) Validate(formats strfmt.Registry) error { return nil } + +// ContextValidate validates this IP s e c policy authentications based on context it is used +func (m IPSECPolicyAuthentications) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/power/models/ip_s_e_c_policy_dh_groups.go b/power/models/ip_s_e_c_policy_dh_groups.go index 8da2cbb0..3db313e5 100644 --- a/power/models/ip_s_e_c_policy_dh_groups.go +++ b/power/models/ip_s_e_c_policy_dh_groups.go @@ -6,10 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + + "github.com/go-openapi/strfmt" ) // IPSECPolicyDhGroups IP s e c policy dh groups +// Example: [1,2,5,14,19,20] +// // swagger:model IPSECPolicyDhGroups type IPSECPolicyDhGroups []float64 @@ -17,3 +21,8 @@ type IPSECPolicyDhGroups []float64 func (m IPSECPolicyDhGroups) Validate(formats strfmt.Registry) error { return nil } + +// ContextValidate validates this IP s e c policy dh groups based on context it is used +func (m IPSECPolicyDhGroups) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/power/models/ip_s_e_c_policy_encryptions.go b/power/models/ip_s_e_c_policy_encryptions.go index ee59af70..930b1056 100644 --- a/power/models/ip_s_e_c_policy_encryptions.go +++ b/power/models/ip_s_e_c_policy_encryptions.go @@ -6,10 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + + "github.com/go-openapi/strfmt" ) // IPSECPolicyEncryptions IP s e c policy encryptions +// Example: ["3des-cbc","aes-128-cbc","aes-128-gcm","aes-256-cbc","aes-256-gcm","des-cbc"] +// // swagger:model IPSECPolicyEncryptions type IPSECPolicyEncryptions []string @@ -17,3 +21,8 @@ type IPSECPolicyEncryptions []string func (m IPSECPolicyEncryptions) Validate(formats strfmt.Registry) error { return nil } + +// ContextValidate validates this IP s e c policy encryptions based on context it is used +func (m IPSECPolicyEncryptions) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/power/models/ip_sec_policies.go b/power/models/ip_sec_policies.go index b763d7aa..6e0996a4 100644 --- a/power/models/ip_sec_policies.go +++ b/power/models/ip_sec_policies.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // IPSecPolicies IP sec policies +// // swagger:model IPSecPolicies type IPSecPolicies struct { @@ -53,6 +54,42 @@ func (m *IPSecPolicies) validateIPSecPolicies(formats strfmt.Registry) error { if err := m.IPSecPolicies[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("ipSecPolicies" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipSecPolicies" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this IP sec policies based on the context it is used +func (m *IPSecPolicies) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateIPSecPolicies(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IPSecPolicies) contextValidateIPSecPolicies(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.IPSecPolicies); i++ { + + if m.IPSecPolicies[i] != nil { + if err := m.IPSecPolicies[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ipSecPolicies" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipSecPolicies" + "." + strconv.Itoa(i)) } return err } diff --git a/power/models/ip_sec_policy.go b/power/models/ip_sec_policy.go index e57dba8b..45c27b2b 100644 --- a/power/models/ip_sec_policy.go +++ b/power/models/ip_sec_policy.go @@ -6,46 +6,52 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // IPSecPolicy IPSec Policy object +// // swagger:model IPSecPolicy type IPSecPolicy struct { // authentication // Required: true - Authentication IPSECPolicyAuthentication `json:"authentication"` + Authentication *IPSECPolicyAuthentication `json:"authentication"` // Diffie-Hellman group + // Example: 2 // Required: true // Enum: [1 2 5 14 19 20 24] DhGroup *int64 `json:"dhGroup"` // connection encryption policy + // Example: 3des-cbc // Required: true // Enum: [3des-cbc aes-128-cbc aes-128-gcm aes-192-cbc aes-192-gcm aes-256-cbc aes-256-gcm des-cbc] Encryption *string `json:"encryption"` // unique identifier of the IPSec Policy + // Example: 6edc8988-eb18-4b5c-a594-0d73d8254463 // Required: true ID *string `json:"id"` // key lifetime // Required: true - KeyLifetime KeyLifetime `json:"keyLifetime"` + KeyLifetime *KeyLifetime `json:"keyLifetime"` // IPSec Policy name + // Example: ipSecPolicy2 // Required: true Name *string `json:"name"` // Perfect Forward Secrecy + // Example: true // Required: true Pfs *bool `json:"pfs"` } @@ -90,13 +96,25 @@ func (m *IPSecPolicy) Validate(formats strfmt.Registry) error { func (m *IPSecPolicy) validateAuthentication(formats strfmt.Registry) error { - if err := m.Authentication.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("authentication") - } + if err := validate.Required("authentication", "body", m.Authentication); err != nil { + return err + } + + if err := validate.Required("authentication", "body", m.Authentication); err != nil { return err } + if m.Authentication != nil { + if err := m.Authentication.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("authentication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("authentication") + } + return err + } + } + return nil } @@ -114,7 +132,7 @@ func init() { // prop value enum func (m *IPSecPolicy) validateDhGroupEnum(path, location string, value int64) error { - if err := validate.Enum(path, location, value, ipSecPolicyTypeDhGroupPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, ipSecPolicyTypeDhGroupPropEnum, true); err != nil { return err } return nil @@ -148,34 +166,34 @@ func init() { const ( - // IPSecPolicyEncryptionNr3desCbc captures enum value "3des-cbc" - IPSecPolicyEncryptionNr3desCbc string = "3des-cbc" + // IPSecPolicyEncryptionNr3desDashCbc captures enum value "3des-cbc" + IPSecPolicyEncryptionNr3desDashCbc string = "3des-cbc" - // IPSecPolicyEncryptionAes128Cbc captures enum value "aes-128-cbc" - IPSecPolicyEncryptionAes128Cbc string = "aes-128-cbc" + // IPSecPolicyEncryptionAesDash128DashCbc captures enum value "aes-128-cbc" + IPSecPolicyEncryptionAesDash128DashCbc string = "aes-128-cbc" - // IPSecPolicyEncryptionAes128Gcm captures enum value "aes-128-gcm" - IPSecPolicyEncryptionAes128Gcm string = "aes-128-gcm" + // IPSecPolicyEncryptionAesDash128DashGcm captures enum value "aes-128-gcm" + IPSecPolicyEncryptionAesDash128DashGcm string = "aes-128-gcm" - // IPSecPolicyEncryptionAes192Cbc captures enum value "aes-192-cbc" - IPSecPolicyEncryptionAes192Cbc string = "aes-192-cbc" + // IPSecPolicyEncryptionAesDash192DashCbc captures enum value "aes-192-cbc" + IPSecPolicyEncryptionAesDash192DashCbc string = "aes-192-cbc" - // IPSecPolicyEncryptionAes192Gcm captures enum value "aes-192-gcm" - IPSecPolicyEncryptionAes192Gcm string = "aes-192-gcm" + // IPSecPolicyEncryptionAesDash192DashGcm captures enum value "aes-192-gcm" + IPSecPolicyEncryptionAesDash192DashGcm string = "aes-192-gcm" - // IPSecPolicyEncryptionAes256Cbc captures enum value "aes-256-cbc" - IPSecPolicyEncryptionAes256Cbc string = "aes-256-cbc" + // IPSecPolicyEncryptionAesDash256DashCbc captures enum value "aes-256-cbc" + IPSecPolicyEncryptionAesDash256DashCbc string = "aes-256-cbc" - // IPSecPolicyEncryptionAes256Gcm captures enum value "aes-256-gcm" - IPSecPolicyEncryptionAes256Gcm string = "aes-256-gcm" + // IPSecPolicyEncryptionAesDash256DashGcm captures enum value "aes-256-gcm" + IPSecPolicyEncryptionAesDash256DashGcm string = "aes-256-gcm" - // IPSecPolicyEncryptionDesCbc captures enum value "des-cbc" - IPSecPolicyEncryptionDesCbc string = "des-cbc" + // IPSecPolicyEncryptionDesDashCbc captures enum value "des-cbc" + IPSecPolicyEncryptionDesDashCbc string = "des-cbc" ) // prop value enum func (m *IPSecPolicy) validateEncryptionEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, ipSecPolicyTypeEncryptionPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, ipSecPolicyTypeEncryptionPropEnum, true); err != nil { return err } return nil @@ -206,13 +224,25 @@ func (m *IPSecPolicy) validateID(formats strfmt.Registry) error { func (m *IPSecPolicy) validateKeyLifetime(formats strfmt.Registry) error { - if err := m.KeyLifetime.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("keyLifetime") - } + if err := validate.Required("keyLifetime", "body", m.KeyLifetime); err != nil { + return err + } + + if err := validate.Required("keyLifetime", "body", m.KeyLifetime); err != nil { return err } + if m.KeyLifetime != nil { + if err := m.KeyLifetime.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keyLifetime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keyLifetime") + } + return err + } + } + return nil } @@ -234,6 +264,56 @@ func (m *IPSecPolicy) validatePfs(formats strfmt.Registry) error { return nil } +// ContextValidate validate this IP sec policy based on the context it is used +func (m *IPSecPolicy) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAuthentication(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateKeyLifetime(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IPSecPolicy) contextValidateAuthentication(ctx context.Context, formats strfmt.Registry) error { + + if m.Authentication != nil { + if err := m.Authentication.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("authentication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("authentication") + } + return err + } + } + + return nil +} + +func (m *IPSecPolicy) contextValidateKeyLifetime(ctx context.Context, formats strfmt.Registry) error { + + if m.KeyLifetime != nil { + if err := m.KeyLifetime.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keyLifetime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keyLifetime") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *IPSecPolicy) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/ip_sec_policy_create.go b/power/models/ip_sec_policy_create.go index 61c7df11..200fe74d 100644 --- a/power/models/ip_sec_policy_create.go +++ b/power/models/ip_sec_policy_create.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // IPSecPolicyCreate IPSec Policy object used for creation +// // swagger:model IPSecPolicyCreate type IPSecPolicyCreate struct { @@ -23,26 +24,30 @@ type IPSecPolicyCreate struct { Authentication IPSECPolicyAuthentication `json:"authentication,omitempty"` // Diffie-Hellman group + // Example: 2 // Required: true // Enum: [1 2 5 14 19 20 24] DhGroup *int64 `json:"dhGroup"` // connection encryption policy + // Example: 3des-cbc // Required: true // Enum: [3des-cbc aes-128-cbc aes-128-gcm aes-192-cbc aes-192-gcm aes-256-cbc aes-256-gcm des-cbc] Encryption *string `json:"encryption"` // key lifetime // Required: true - KeyLifetime KeyLifetime `json:"keyLifetime"` + KeyLifetime *KeyLifetime `json:"keyLifetime"` // IPSec Policy name + // Example: ipSecPolicy2 // Required: true // Max Length: 47 // Min Length: 1 Name *string `json:"name"` // Perfect Forward Secrecy + // Example: true // Required: true Pfs *bool `json:"pfs"` } @@ -82,7 +87,6 @@ func (m *IPSecPolicyCreate) Validate(formats strfmt.Registry) error { } func (m *IPSecPolicyCreate) validateAuthentication(formats strfmt.Registry) error { - if swag.IsZero(m.Authentication) { // not required return nil } @@ -90,6 +94,8 @@ func (m *IPSecPolicyCreate) validateAuthentication(formats strfmt.Registry) erro if err := m.Authentication.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("authentication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("authentication") } return err } @@ -111,7 +117,7 @@ func init() { // prop value enum func (m *IPSecPolicyCreate) validateDhGroupEnum(path, location string, value int64) error { - if err := validate.Enum(path, location, value, ipSecPolicyCreateTypeDhGroupPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, ipSecPolicyCreateTypeDhGroupPropEnum, true); err != nil { return err } return nil @@ -145,34 +151,34 @@ func init() { const ( - // IPSecPolicyCreateEncryptionNr3desCbc captures enum value "3des-cbc" - IPSecPolicyCreateEncryptionNr3desCbc string = "3des-cbc" + // IPSecPolicyCreateEncryptionNr3desDashCbc captures enum value "3des-cbc" + IPSecPolicyCreateEncryptionNr3desDashCbc string = "3des-cbc" - // IPSecPolicyCreateEncryptionAes128Cbc captures enum value "aes-128-cbc" - IPSecPolicyCreateEncryptionAes128Cbc string = "aes-128-cbc" + // IPSecPolicyCreateEncryptionAesDash128DashCbc captures enum value "aes-128-cbc" + IPSecPolicyCreateEncryptionAesDash128DashCbc string = "aes-128-cbc" - // IPSecPolicyCreateEncryptionAes128Gcm captures enum value "aes-128-gcm" - IPSecPolicyCreateEncryptionAes128Gcm string = "aes-128-gcm" + // IPSecPolicyCreateEncryptionAesDash128DashGcm captures enum value "aes-128-gcm" + IPSecPolicyCreateEncryptionAesDash128DashGcm string = "aes-128-gcm" - // IPSecPolicyCreateEncryptionAes192Cbc captures enum value "aes-192-cbc" - IPSecPolicyCreateEncryptionAes192Cbc string = "aes-192-cbc" + // IPSecPolicyCreateEncryptionAesDash192DashCbc captures enum value "aes-192-cbc" + IPSecPolicyCreateEncryptionAesDash192DashCbc string = "aes-192-cbc" - // IPSecPolicyCreateEncryptionAes192Gcm captures enum value "aes-192-gcm" - IPSecPolicyCreateEncryptionAes192Gcm string = "aes-192-gcm" + // IPSecPolicyCreateEncryptionAesDash192DashGcm captures enum value "aes-192-gcm" + IPSecPolicyCreateEncryptionAesDash192DashGcm string = "aes-192-gcm" - // IPSecPolicyCreateEncryptionAes256Cbc captures enum value "aes-256-cbc" - IPSecPolicyCreateEncryptionAes256Cbc string = "aes-256-cbc" + // IPSecPolicyCreateEncryptionAesDash256DashCbc captures enum value "aes-256-cbc" + IPSecPolicyCreateEncryptionAesDash256DashCbc string = "aes-256-cbc" - // IPSecPolicyCreateEncryptionAes256Gcm captures enum value "aes-256-gcm" - IPSecPolicyCreateEncryptionAes256Gcm string = "aes-256-gcm" + // IPSecPolicyCreateEncryptionAesDash256DashGcm captures enum value "aes-256-gcm" + IPSecPolicyCreateEncryptionAesDash256DashGcm string = "aes-256-gcm" - // IPSecPolicyCreateEncryptionDesCbc captures enum value "des-cbc" - IPSecPolicyCreateEncryptionDesCbc string = "des-cbc" + // IPSecPolicyCreateEncryptionDesDashCbc captures enum value "des-cbc" + IPSecPolicyCreateEncryptionDesDashCbc string = "des-cbc" ) // prop value enum func (m *IPSecPolicyCreate) validateEncryptionEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, ipSecPolicyCreateTypeEncryptionPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, ipSecPolicyCreateTypeEncryptionPropEnum, true); err != nil { return err } return nil @@ -194,13 +200,25 @@ func (m *IPSecPolicyCreate) validateEncryption(formats strfmt.Registry) error { func (m *IPSecPolicyCreate) validateKeyLifetime(formats strfmt.Registry) error { - if err := m.KeyLifetime.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("keyLifetime") - } + if err := validate.Required("keyLifetime", "body", m.KeyLifetime); err != nil { return err } + if err := validate.Required("keyLifetime", "body", m.KeyLifetime); err != nil { + return err + } + + if m.KeyLifetime != nil { + if err := m.KeyLifetime.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keyLifetime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keyLifetime") + } + return err + } + } + return nil } @@ -210,11 +228,11 @@ func (m *IPSecPolicyCreate) validateName(formats strfmt.Registry) error { return err } - if err := validate.MinLength("name", "body", string(*m.Name), 1); err != nil { + if err := validate.MinLength("name", "body", *m.Name, 1); err != nil { return err } - if err := validate.MaxLength("name", "body", string(*m.Name), 47); err != nil { + if err := validate.MaxLength("name", "body", *m.Name, 47); err != nil { return err } @@ -230,6 +248,54 @@ func (m *IPSecPolicyCreate) validatePfs(formats strfmt.Registry) error { return nil } +// ContextValidate validate this IP sec policy create based on the context it is used +func (m *IPSecPolicyCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAuthentication(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateKeyLifetime(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IPSecPolicyCreate) contextValidateAuthentication(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Authentication.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("authentication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("authentication") + } + return err + } + + return nil +} + +func (m *IPSecPolicyCreate) contextValidateKeyLifetime(ctx context.Context, formats strfmt.Registry) error { + + if m.KeyLifetime != nil { + if err := m.KeyLifetime.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keyLifetime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keyLifetime") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *IPSecPolicyCreate) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/ip_sec_policy_options.go b/power/models/ip_sec_policy_options.go index c0aa5319..07841dff 100644 --- a/power/models/ip_sec_policy_options.go +++ b/power/models/ip_sec_policy_options.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // IPSecPolicyOptions IP sec policy options +// // swagger:model IPSecPolicyOptions type IPSecPolicyOptions struct { @@ -61,6 +63,8 @@ func (m *IPSecPolicyOptions) validateAuthentications(formats strfmt.Registry) er if err := m.Authentications.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("authentications") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("authentications") } return err } @@ -77,6 +81,8 @@ func (m *IPSecPolicyOptions) validateDhGroups(formats strfmt.Registry) error { if err := m.DhGroups.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("dhGroups") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("dhGroups") } return err } @@ -93,6 +99,72 @@ func (m *IPSecPolicyOptions) validateEncryptions(formats strfmt.Registry) error if err := m.Encryptions.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("encryptions") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("encryptions") + } + return err + } + + return nil +} + +// ContextValidate validate this IP sec policy options based on the context it is used +func (m *IPSecPolicyOptions) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAuthentications(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateDhGroups(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateEncryptions(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IPSecPolicyOptions) contextValidateAuthentications(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Authentications.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("authentications") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("authentications") + } + return err + } + + return nil +} + +func (m *IPSecPolicyOptions) contextValidateDhGroups(ctx context.Context, formats strfmt.Registry) error { + + if err := m.DhGroups.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("dhGroups") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("dhGroups") + } + return err + } + + return nil +} + +func (m *IPSecPolicyOptions) contextValidateEncryptions(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Encryptions.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("encryptions") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("encryptions") } return err } diff --git a/power/models/ip_sec_policy_ref.go b/power/models/ip_sec_policy_ref.go index f68ed117..4b5a384f 100644 --- a/power/models/ip_sec_policy_ref.go +++ b/power/models/ip_sec_policy_ref.go @@ -6,22 +6,26 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // IPSecPolicyRef IPSec Policy reference object +// // swagger:model IPSecPolicyRef type IPSecPolicyRef struct { // unique identifier of IPSec Policy + // Example: 7abc1234-ab18-4b5c-b123-0d73e8254463 // Required: true ID *string `json:"id"` // name of IPSec Policy + // Example: IPSec Policy 1 // Required: true Name *string `json:"name"` } @@ -62,6 +66,11 @@ func (m *IPSecPolicyRef) validateName(formats strfmt.Registry) error { return nil } +// ContextValidate validates this IP sec policy ref based on context it is used +func (m *IPSecPolicyRef) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *IPSecPolicyRef) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/ip_sec_policy_template.go b/power/models/ip_sec_policy_template.go index 811a8c55..fe393daf 100644 --- a/power/models/ip_sec_policy_template.go +++ b/power/models/ip_sec_policy_template.go @@ -6,32 +6,37 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // IPSecPolicyTemplate IP sec policy template +// // swagger:model IPSecPolicyTemplate type IPSecPolicyTemplate struct { // ipSecPolicy Authentication default value + // Example: sha256 // Required: true Authentication *string `json:"authentication"` // ipSecPolicy DHGroup default value + // Example: 2 // Required: true DhGroup *int64 `json:"dhGroup"` // ipSecPolicy Encryption default value + // Example: 3des-cbc // Required: true Encryption *string `json:"encryption"` // key lifetime // Required: true - KeyLifetime KeyLifetime `json:"keyLifetime"` + KeyLifetime *KeyLifetime `json:"keyLifetime"` } // Validate validates this IP sec policy template @@ -89,13 +94,55 @@ func (m *IPSecPolicyTemplate) validateEncryption(formats strfmt.Registry) error func (m *IPSecPolicyTemplate) validateKeyLifetime(formats strfmt.Registry) error { - if err := m.KeyLifetime.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("keyLifetime") - } + if err := validate.Required("keyLifetime", "body", m.KeyLifetime); err != nil { + return err + } + + if err := validate.Required("keyLifetime", "body", m.KeyLifetime); err != nil { return err } + if m.KeyLifetime != nil { + if err := m.KeyLifetime.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keyLifetime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keyLifetime") + } + return err + } + } + + return nil +} + +// ContextValidate validate this IP sec policy template based on the context it is used +func (m *IPSecPolicyTemplate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateKeyLifetime(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IPSecPolicyTemplate) contextValidateKeyLifetime(ctx context.Context, formats strfmt.Registry) error { + + if m.KeyLifetime != nil { + if err := m.KeyLifetime.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keyLifetime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keyLifetime") + } + return err + } + } + return nil } diff --git a/power/models/ip_sec_policy_update.go b/power/models/ip_sec_policy_update.go index 8d73c49a..9099ae11 100644 --- a/power/models/ip_sec_policy_update.go +++ b/power/models/ip_sec_policy_update.go @@ -6,16 +6,19 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // IPSecPolicyUpdate IPSEc Policy object used for update +// +// Min Properties: 1 +// // swagger:model IPSecPolicyUpdate type IPSecPolicyUpdate struct { @@ -23,10 +26,12 @@ type IPSecPolicyUpdate struct { Authentication IPSECPolicyAuthentication `json:"authentication,omitempty"` // Diffie-Hellman group + // Example: 2 // Enum: [1 2 5 14 19 20 24] DhGroup int64 `json:"dhGroup,omitempty"` // connection encryption policy + // Example: 3des-cbc // Enum: [3des-cbc aes-128-cbc aes-128-gcm aes-192-cbc aes-192-gcm aes-256-cbc aes-256-gcm des-cbc] Encryption string `json:"encryption,omitempty"` @@ -34,11 +39,13 @@ type IPSecPolicyUpdate struct { KeyLifetime KeyLifetime `json:"keyLifetime,omitempty"` // IPSec Policy name + // Example: ipSecPolicy2 // Max Length: 47 // Min Length: 1 Name string `json:"name,omitempty"` // Perfect Forward Secrecy + // Example: true Pfs *bool `json:"pfs,omitempty"` // IP sec policy update additional properties @@ -54,10 +61,12 @@ func (m *IPSecPolicyUpdate) UnmarshalJSON(data []byte) error { Authentication IPSECPolicyAuthentication `json:"authentication,omitempty"` // Diffie-Hellman group + // Example: 2 // Enum: [1 2 5 14 19 20 24] DhGroup int64 `json:"dhGroup,omitempty"` // connection encryption policy + // Example: 3des-cbc // Enum: [3des-cbc aes-128-cbc aes-128-gcm aes-192-cbc aes-192-gcm aes-256-cbc aes-256-gcm des-cbc] Encryption string `json:"encryption,omitempty"` @@ -65,11 +74,13 @@ func (m *IPSecPolicyUpdate) UnmarshalJSON(data []byte) error { KeyLifetime KeyLifetime `json:"keyLifetime,omitempty"` // IPSec Policy name + // Example: ipSecPolicy2 // Max Length: 47 // Min Length: 1 Name string `json:"name,omitempty"` // Perfect Forward Secrecy + // Example: true Pfs *bool `json:"pfs,omitempty"` } if err := json.Unmarshal(data, &stage1); err != nil { @@ -78,17 +89,11 @@ func (m *IPSecPolicyUpdate) UnmarshalJSON(data []byte) error { var rcv IPSecPolicyUpdate rcv.Authentication = stage1.Authentication - rcv.DhGroup = stage1.DhGroup - rcv.Encryption = stage1.Encryption - rcv.KeyLifetime = stage1.KeyLifetime - rcv.Name = stage1.Name - rcv.Pfs = stage1.Pfs - *m = rcv // stage 2, remove properties and add to map @@ -98,17 +103,11 @@ func (m *IPSecPolicyUpdate) UnmarshalJSON(data []byte) error { } delete(stage2, "authentication") - delete(stage2, "dhGroup") - delete(stage2, "encryption") - delete(stage2, "keyLifetime") - delete(stage2, "name") - delete(stage2, "pfs") - // stage 3, add additional properties values if len(stage2) > 0 { result := make(map[string]interface{}) @@ -133,10 +132,12 @@ func (m IPSecPolicyUpdate) MarshalJSON() ([]byte, error) { Authentication IPSECPolicyAuthentication `json:"authentication,omitempty"` // Diffie-Hellman group + // Example: 2 // Enum: [1 2 5 14 19 20 24] DhGroup int64 `json:"dhGroup,omitempty"` // connection encryption policy + // Example: 3des-cbc // Enum: [3des-cbc aes-128-cbc aes-128-gcm aes-192-cbc aes-192-gcm aes-256-cbc aes-256-gcm des-cbc] Encryption string `json:"encryption,omitempty"` @@ -144,24 +145,21 @@ func (m IPSecPolicyUpdate) MarshalJSON() ([]byte, error) { KeyLifetime KeyLifetime `json:"keyLifetime,omitempty"` // IPSec Policy name + // Example: ipSecPolicy2 // Max Length: 47 // Min Length: 1 Name string `json:"name,omitempty"` // Perfect Forward Secrecy + // Example: true Pfs *bool `json:"pfs,omitempty"` } stage1.Authentication = m.Authentication - stage1.DhGroup = m.DhGroup - stage1.Encryption = m.Encryption - stage1.KeyLifetime = m.KeyLifetime - stage1.Name = m.Name - stage1.Pfs = m.Pfs // make JSON object for known properties @@ -170,7 +168,7 @@ func (m IPSecPolicyUpdate) MarshalJSON() ([]byte, error) { return nil, err } - if len(m.IPSecPolicyUpdateAdditionalProperties) == 0 { + if len(m.IPSecPolicyUpdateAdditionalProperties) == 0 { // no additional properties return props, nil } @@ -180,19 +178,40 @@ func (m IPSecPolicyUpdate) MarshalJSON() ([]byte, error) { return nil, err } - if len(props) < 3 { + if len(props) < 3 { // "{}": only additional properties return additional, nil } // concatenate the 2 objects - props[len(props)-1] = ',' - return append(props, additional[1:]...), nil + return swag.ConcatJSON(props, additional), nil } // Validate validates this IP sec policy update func (m *IPSecPolicyUpdate) Validate(formats strfmt.Registry) error { var res []error + // short circuits minProperties > 0 + if m == nil { + return errors.TooFewProperties("", "body", 1) + } + + props := make(map[string]json.RawMessage, 6+10) + j, err := swag.WriteJSON(m) + if err != nil { + return err + } + + if err = swag.ReadJSON(j, &props); err != nil { + return err + } + + nprops := len(props) + + // minProperties: 1 + if nprops < 1 { + return errors.TooFewProperties("", "body", 1) + } + if err := m.validateAuthentication(formats); err != nil { res = append(res, err) } @@ -220,7 +239,6 @@ func (m *IPSecPolicyUpdate) Validate(formats strfmt.Registry) error { } func (m *IPSecPolicyUpdate) validateAuthentication(formats strfmt.Registry) error { - if swag.IsZero(m.Authentication) { // not required return nil } @@ -228,6 +246,8 @@ func (m *IPSecPolicyUpdate) validateAuthentication(formats strfmt.Registry) erro if err := m.Authentication.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("authentication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("authentication") } return err } @@ -249,14 +269,13 @@ func init() { // prop value enum func (m *IPSecPolicyUpdate) validateDhGroupEnum(path, location string, value int64) error { - if err := validate.Enum(path, location, value, ipSecPolicyUpdateTypeDhGroupPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, ipSecPolicyUpdateTypeDhGroupPropEnum, true); err != nil { return err } return nil } func (m *IPSecPolicyUpdate) validateDhGroup(formats strfmt.Registry) error { - if swag.IsZero(m.DhGroup) { // not required return nil } @@ -283,41 +302,40 @@ func init() { const ( - // IPSecPolicyUpdateEncryptionNr3desCbc captures enum value "3des-cbc" - IPSecPolicyUpdateEncryptionNr3desCbc string = "3des-cbc" + // IPSecPolicyUpdateEncryptionNr3desDashCbc captures enum value "3des-cbc" + IPSecPolicyUpdateEncryptionNr3desDashCbc string = "3des-cbc" - // IPSecPolicyUpdateEncryptionAes128Cbc captures enum value "aes-128-cbc" - IPSecPolicyUpdateEncryptionAes128Cbc string = "aes-128-cbc" + // IPSecPolicyUpdateEncryptionAesDash128DashCbc captures enum value "aes-128-cbc" + IPSecPolicyUpdateEncryptionAesDash128DashCbc string = "aes-128-cbc" - // IPSecPolicyUpdateEncryptionAes128Gcm captures enum value "aes-128-gcm" - IPSecPolicyUpdateEncryptionAes128Gcm string = "aes-128-gcm" + // IPSecPolicyUpdateEncryptionAesDash128DashGcm captures enum value "aes-128-gcm" + IPSecPolicyUpdateEncryptionAesDash128DashGcm string = "aes-128-gcm" - // IPSecPolicyUpdateEncryptionAes192Cbc captures enum value "aes-192-cbc" - IPSecPolicyUpdateEncryptionAes192Cbc string = "aes-192-cbc" + // IPSecPolicyUpdateEncryptionAesDash192DashCbc captures enum value "aes-192-cbc" + IPSecPolicyUpdateEncryptionAesDash192DashCbc string = "aes-192-cbc" - // IPSecPolicyUpdateEncryptionAes192Gcm captures enum value "aes-192-gcm" - IPSecPolicyUpdateEncryptionAes192Gcm string = "aes-192-gcm" + // IPSecPolicyUpdateEncryptionAesDash192DashGcm captures enum value "aes-192-gcm" + IPSecPolicyUpdateEncryptionAesDash192DashGcm string = "aes-192-gcm" - // IPSecPolicyUpdateEncryptionAes256Cbc captures enum value "aes-256-cbc" - IPSecPolicyUpdateEncryptionAes256Cbc string = "aes-256-cbc" + // IPSecPolicyUpdateEncryptionAesDash256DashCbc captures enum value "aes-256-cbc" + IPSecPolicyUpdateEncryptionAesDash256DashCbc string = "aes-256-cbc" - // IPSecPolicyUpdateEncryptionAes256Gcm captures enum value "aes-256-gcm" - IPSecPolicyUpdateEncryptionAes256Gcm string = "aes-256-gcm" + // IPSecPolicyUpdateEncryptionAesDash256DashGcm captures enum value "aes-256-gcm" + IPSecPolicyUpdateEncryptionAesDash256DashGcm string = "aes-256-gcm" - // IPSecPolicyUpdateEncryptionDesCbc captures enum value "des-cbc" - IPSecPolicyUpdateEncryptionDesCbc string = "des-cbc" + // IPSecPolicyUpdateEncryptionDesDashCbc captures enum value "des-cbc" + IPSecPolicyUpdateEncryptionDesDashCbc string = "des-cbc" ) // prop value enum func (m *IPSecPolicyUpdate) validateEncryptionEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, ipSecPolicyUpdateTypeEncryptionPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, ipSecPolicyUpdateTypeEncryptionPropEnum, true); err != nil { return err } return nil } func (m *IPSecPolicyUpdate) validateEncryption(formats strfmt.Registry) error { - if swag.IsZero(m.Encryption) { // not required return nil } @@ -331,7 +349,6 @@ func (m *IPSecPolicyUpdate) validateEncryption(formats strfmt.Registry) error { } func (m *IPSecPolicyUpdate) validateKeyLifetime(formats strfmt.Registry) error { - if swag.IsZero(m.KeyLifetime) { // not required return nil } @@ -339,6 +356,8 @@ func (m *IPSecPolicyUpdate) validateKeyLifetime(formats strfmt.Registry) error { if err := m.KeyLifetime.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("keyLifetime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keyLifetime") } return err } @@ -347,16 +366,61 @@ func (m *IPSecPolicyUpdate) validateKeyLifetime(formats strfmt.Registry) error { } func (m *IPSecPolicyUpdate) validateName(formats strfmt.Registry) error { - if swag.IsZero(m.Name) { // not required return nil } - if err := validate.MinLength("name", "body", string(m.Name), 1); err != nil { + if err := validate.MinLength("name", "body", m.Name, 1); err != nil { return err } - if err := validate.MaxLength("name", "body", string(m.Name), 47); err != nil { + if err := validate.MaxLength("name", "body", m.Name, 47); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this IP sec policy update based on the context it is used +func (m *IPSecPolicyUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAuthentication(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateKeyLifetime(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IPSecPolicyUpdate) contextValidateAuthentication(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Authentication.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("authentication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("authentication") + } + return err + } + + return nil +} + +func (m *IPSecPolicyUpdate) contextValidateKeyLifetime(ctx context.Context, formats strfmt.Registry) error { + + if err := m.KeyLifetime.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keyLifetime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keyLifetime") + } return err } diff --git a/power/models/job.go b/power/models/job.go index 7b5b4fed..fd59b76c 100644 --- a/power/models/job.go +++ b/power/models/job.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Job job +// // swagger:model Job type Job struct { @@ -61,7 +63,6 @@ func (m *Job) Validate(formats strfmt.Registry) error { } func (m *Job) validateCreateTimestamp(formats strfmt.Registry) error { - if swag.IsZero(m.CreateTimestamp) { // not required return nil } @@ -92,6 +93,8 @@ func (m *Job) validateOperation(formats strfmt.Registry) error { if err := m.Operation.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("operation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("operation") } return err } @@ -110,6 +113,58 @@ func (m *Job) validateStatus(formats strfmt.Registry) error { if err := m.Status.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("status") + } + return err + } + } + + return nil +} + +// ContextValidate validate this job based on the context it is used +func (m *Job) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateOperation(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStatus(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Job) contextValidateOperation(ctx context.Context, formats strfmt.Registry) error { + + if m.Operation != nil { + if err := m.Operation.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("operation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("operation") + } + return err + } + } + + return nil +} + +func (m *Job) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error { + + if m.Status != nil { + if err := m.Status.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("status") } return err } diff --git a/power/models/job_reference.go b/power/models/job_reference.go index fb776e5d..dc09f76f 100644 --- a/power/models/job_reference.go +++ b/power/models/job_reference.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // JobReference job reference +// // swagger:model JobReference type JobReference struct { @@ -62,6 +64,11 @@ func (m *JobReference) validateID(formats strfmt.Registry) error { return nil } +// ContextValidate validates this job reference based on context it is used +func (m *JobReference) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *JobReference) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/jobs.go b/power/models/jobs.go index 64c27e70..99fd189b 100644 --- a/power/models/jobs.go +++ b/power/models/jobs.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Jobs jobs +// // swagger:model Jobs type Jobs struct { @@ -53,6 +54,42 @@ func (m *Jobs) validateJobs(formats strfmt.Registry) error { if err := m.Jobs[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("jobs" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("jobs" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this jobs based on the context it is used +func (m *Jobs) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateJobs(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Jobs) contextValidateJobs(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Jobs); i++ { + + if m.Jobs[i] != nil { + if err := m.Jobs[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("jobs" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("jobs" + "." + strconv.Itoa(i)) } return err } diff --git a/power/models/json_schema_object.go b/power/models/json_schema_object.go index ea8f359b..9fec438a 100644 --- a/power/models/json_schema_object.go +++ b/power/models/json_schema_object.go @@ -6,5 +6,6 @@ package models // Editing this file might prove futile when you re-run the swagger generate command // JSONSchemaObject JSON schema object +// // swagger:model JSONSchemaObject type JSONSchemaObject interface{} diff --git a/power/models/key_lifetime.go b/power/models/key_lifetime.go index 8ca05e06..053deebb 100644 --- a/power/models/key_lifetime.go +++ b/power/models/key_lifetime.go @@ -6,13 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/validate" ) // KeyLifetime Policy key lifetime +// Example: 28800 +// // swagger:model KeyLifetime type KeyLifetime int64 @@ -33,3 +36,8 @@ func (m KeyLifetime) Validate(formats strfmt.Registry) error { } return nil } + +// ContextValidate validates this key lifetime based on context it is used +func (m KeyLifetime) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/power/models/last_operation_resource.go b/power/models/last_operation_resource.go index 558cd5a0..37596b72 100644 --- a/power/models/last_operation_resource.go +++ b/power/models/last_operation_resource.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // LastOperationResource last operation resource +// // swagger:model LastOperationResource type LastOperationResource struct { @@ -68,7 +69,7 @@ const ( // prop value enum func (m *LastOperationResource) validateStateEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, lastOperationResourceTypeStatePropEnum); err != nil { + if err := validate.EnumCase(path, location, value, lastOperationResourceTypeStatePropEnum, true); err != nil { return err } return nil @@ -88,6 +89,11 @@ func (m *LastOperationResource) validateState(formats strfmt.Registry) error { return nil } +// ContextValidate validates this last operation resource based on context it is used +func (m *LastOperationResource) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *LastOperationResource) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/maximum_storage_allocation.go b/power/models/maximum_storage_allocation.go index dfac4c98..d33f36f3 100644 --- a/power/models/maximum_storage_allocation.go +++ b/power/models/maximum_storage_allocation.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // MaximumStorageAllocation Maximum storage allocation +// // swagger:model MaximumStorageAllocation type MaximumStorageAllocation struct { @@ -79,6 +81,11 @@ func (m *MaximumStorageAllocation) validateStorageType(formats strfmt.Registry) return nil } +// ContextValidate validates this maximum storage allocation based on context it is used +func (m *MaximumStorageAllocation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *MaximumStorageAllocation) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/metadata.go b/power/models/metadata.go index e8ddbbdc..fcebea3a 100644 --- a/power/models/metadata.go +++ b/power/models/metadata.go @@ -6,5 +6,6 @@ package models // Editing this file might prove futile when you re-run the swagger generate command // Metadata See [Service Metadata Conventions](https://github.com/openservicebrokerapi/servicebroker/blob/master/profile.md#service-metadata) for more details. +// // swagger:model Metadata type Metadata interface{} diff --git a/power/models/min_max_default.go b/power/models/min_max_default.go index 06238e2e..1237d64c 100644 --- a/power/models/min_max_default.go +++ b/power/models/min_max_default.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // MinMaxDefault min max default +// // swagger:model MinMaxDefault type MinMaxDefault struct { @@ -79,6 +81,11 @@ func (m *MinMaxDefault) validateMin(formats strfmt.Registry) error { return nil } +// ContextValidate validates this min max default based on context it is used +func (m *MinMaxDefault) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *MinMaxDefault) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/multi_volumes_create.go b/power/models/multi_volumes_create.go index 69859b1d..46527787 100644 --- a/power/models/multi_volumes_create.go +++ b/power/models/multi_volumes_create.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // MultiVolumesCreate multi volumes create +// // swagger:model MultiVolumesCreate type MultiVolumesCreate struct { @@ -98,20 +99,19 @@ const ( // MultiVolumesCreateAffinityPolicyAffinity captures enum value "affinity" MultiVolumesCreateAffinityPolicyAffinity string = "affinity" - // MultiVolumesCreateAffinityPolicyAntiAffinity captures enum value "anti-affinity" - MultiVolumesCreateAffinityPolicyAntiAffinity string = "anti-affinity" + // MultiVolumesCreateAffinityPolicyAntiDashAffinity captures enum value "anti-affinity" + MultiVolumesCreateAffinityPolicyAntiDashAffinity string = "anti-affinity" ) // prop value enum func (m *MultiVolumesCreate) validateAffinityPolicyEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, multiVolumesCreateTypeAffinityPolicyPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, multiVolumesCreateTypeAffinityPolicyPropEnum, true); err != nil { return err } return nil } func (m *MultiVolumesCreate) validateAffinityPolicy(formats strfmt.Registry) error { - if swag.IsZero(m.AffinityPolicy) { // not required return nil } @@ -142,6 +142,11 @@ func (m *MultiVolumesCreate) validateSize(formats strfmt.Registry) error { return nil } +// ContextValidate validates this multi volumes create based on context it is used +func (m *MultiVolumesCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *MultiVolumesCreate) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/network.go b/power/models/network.go index b4036d34..0d008cd8 100644 --- a/power/models/network.go +++ b/power/models/network.go @@ -6,17 +6,18 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Network network +// // swagger:model Network type Network struct { @@ -134,7 +135,6 @@ func (m *Network) validateCidr(formats strfmt.Registry) error { } func (m *Network) validateCloudConnections(formats strfmt.Registry) error { - if swag.IsZero(m.CloudConnections) { // not required return nil } @@ -148,6 +148,8 @@ func (m *Network) validateCloudConnections(formats strfmt.Registry) error { if err := m.CloudConnections[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("cloudConnections" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("cloudConnections" + "." + strconv.Itoa(i)) } return err } @@ -177,6 +179,8 @@ func (m *Network) validateIPAddressMetrics(formats strfmt.Registry) error { if err := m.IPAddressMetrics.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("ipAddressMetrics") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipAddressMetrics") } return err } @@ -200,6 +204,8 @@ func (m *Network) validateIPAddressRanges(formats strfmt.Registry) error { if err := m.IPAddressRanges[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("ipAddressRanges" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipAddressRanges" + "." + strconv.Itoa(i)) } return err } @@ -238,7 +244,6 @@ func (m *Network) validateNetworkID(formats strfmt.Registry) error { } func (m *Network) validatePublicIPAddressRanges(formats strfmt.Registry) error { - if swag.IsZero(m.PublicIPAddressRanges) { // not required return nil } @@ -252,6 +257,8 @@ func (m *Network) validatePublicIPAddressRanges(formats strfmt.Registry) error { if err := m.PublicIPAddressRanges[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("publicIPAddressRanges" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("publicIPAddressRanges" + "." + strconv.Itoa(i)) } return err } @@ -279,13 +286,13 @@ const ( // NetworkTypeVlan captures enum value "vlan" NetworkTypeVlan string = "vlan" - // NetworkTypePubVlan captures enum value "pub-vlan" - NetworkTypePubVlan string = "pub-vlan" + // NetworkTypePubDashVlan captures enum value "pub-vlan" + NetworkTypePubDashVlan string = "pub-vlan" ) // prop value enum func (m *Network) validateTypeEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, networkTypeTypePropEnum); err != nil { + if err := validate.EnumCase(path, location, value, networkTypeTypePropEnum, true); err != nil { return err } return nil @@ -314,6 +321,108 @@ func (m *Network) validateVlanID(formats strfmt.Registry) error { return nil } +// ContextValidate validate this network based on the context it is used +func (m *Network) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCloudConnections(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateIPAddressMetrics(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateIPAddressRanges(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePublicIPAddressRanges(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Network) contextValidateCloudConnections(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.CloudConnections); i++ { + + if m.CloudConnections[i] != nil { + if err := m.CloudConnections[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cloudConnections" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("cloudConnections" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Network) contextValidateIPAddressMetrics(ctx context.Context, formats strfmt.Registry) error { + + if m.IPAddressMetrics != nil { + if err := m.IPAddressMetrics.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ipAddressMetrics") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipAddressMetrics") + } + return err + } + } + + return nil +} + +func (m *Network) contextValidateIPAddressRanges(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.IPAddressRanges); i++ { + + if m.IPAddressRanges[i] != nil { + if err := m.IPAddressRanges[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ipAddressRanges" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipAddressRanges" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Network) contextValidatePublicIPAddressRanges(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.PublicIPAddressRanges); i++ { + + if m.PublicIPAddressRanges[i] != nil { + if err := m.PublicIPAddressRanges[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("publicIPAddressRanges" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("publicIPAddressRanges" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *Network) MarshalBinary() ([]byte, error) { if m == nil { @@ -333,6 +442,7 @@ func (m *Network) UnmarshalBinary(b []byte) error { } // NetworkCloudConnectionsItems0 network cloud connections items0 +// // swagger:model NetworkCloudConnectionsItems0 type NetworkCloudConnectionsItems0 struct { @@ -348,6 +458,11 @@ func (m *NetworkCloudConnectionsItems0) Validate(formats strfmt.Registry) error return nil } +// ContextValidate validates this network cloud connections items0 based on context it is used +func (m *NetworkCloudConnectionsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *NetworkCloudConnectionsItems0) MarshalBinary() ([]byte, error) { if m == nil { @@ -367,6 +482,7 @@ func (m *NetworkCloudConnectionsItems0) UnmarshalBinary(b []byte) error { } // NetworkIPAddressMetrics IP Address Metrics +// // swagger:model NetworkIPAddressMetrics type NetworkIPAddressMetrics struct { @@ -449,6 +565,11 @@ func (m *NetworkIPAddressMetrics) validateUtilization(formats strfmt.Registry) e return nil } +// ContextValidate validates this network IP address metrics based on context it is used +func (m *NetworkIPAddressMetrics) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *NetworkIPAddressMetrics) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/network_create.go b/power/models/network_create.go index bdd9072c..c5a54d8f 100644 --- a/power/models/network_create.go +++ b/power/models/network_create.go @@ -6,17 +6,18 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // NetworkCreate network create +// // swagger:model NetworkCreate type NetworkCreate struct { @@ -63,7 +64,6 @@ func (m *NetworkCreate) Validate(formats strfmt.Registry) error { } func (m *NetworkCreate) validateIPAddressRanges(formats strfmt.Registry) error { - if swag.IsZero(m.IPAddressRanges) { // not required return nil } @@ -77,6 +77,8 @@ func (m *NetworkCreate) validateIPAddressRanges(formats strfmt.Registry) error { if err := m.IPAddressRanges[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("ipAddressRanges" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipAddressRanges" + "." + strconv.Itoa(i)) } return err } @@ -104,13 +106,13 @@ const ( // NetworkCreateTypeVlan captures enum value "vlan" NetworkCreateTypeVlan string = "vlan" - // NetworkCreateTypePubVlan captures enum value "pub-vlan" - NetworkCreateTypePubVlan string = "pub-vlan" + // NetworkCreateTypePubDashVlan captures enum value "pub-vlan" + NetworkCreateTypePubDashVlan string = "pub-vlan" ) // prop value enum func (m *NetworkCreate) validateTypeEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, networkCreateTypeTypePropEnum); err != nil { + if err := validate.EnumCase(path, location, value, networkCreateTypeTypePropEnum, true); err != nil { return err } return nil @@ -130,6 +132,40 @@ func (m *NetworkCreate) validateType(formats strfmt.Registry) error { return nil } +// ContextValidate validate this network create based on the context it is used +func (m *NetworkCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateIPAddressRanges(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkCreate) contextValidateIPAddressRanges(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.IPAddressRanges); i++ { + + if m.IPAddressRanges[i] != nil { + if err := m.IPAddressRanges[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ipAddressRanges" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipAddressRanges" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *NetworkCreate) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/network_i_ds.go b/power/models/network_i_ds.go new file mode 100644 index 00000000..e2ceb6fc --- /dev/null +++ b/power/models/network_i_ds.go @@ -0,0 +1,51 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NetworkIDs network i ds +// +// swagger:model NetworkIDs +type NetworkIDs struct { + + // an array of network IDs + // Example: ["7f950c76-8582-11qeb-8dcd-0242ac143","7f950c76-8582-11veb-8dcd-0242ac153","7f950c76-8582-11deb-8dcd-0242ac163"] + NetworkIDs []string `json:"networkIDs"` +} + +// Validate validates this network i ds +func (m *NetworkIDs) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this network i ds based on context it is used +func (m *NetworkIDs) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkIDs) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkIDs) UnmarshalBinary(b []byte) error { + var res NetworkIDs + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_id.go b/power/models/network_id.go index 87f86d07..98ab9bdd 100644 --- a/power/models/network_id.go +++ b/power/models/network_id.go @@ -6,18 +6,21 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // NetworkID unique identifier of a network +// // swagger:model NetworkID type NetworkID struct { // network ID + // Example: 7f950c76-8582-11qeb-8dcd-0242ac172 // Required: true NetworkID *string `json:"networkID"` } @@ -45,6 +48,11 @@ func (m *NetworkID) validateNetworkID(formats strfmt.Registry) error { return nil } +// ContextValidate validates this network ID based on context it is used +func (m *NetworkID) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *NetworkID) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/network_port.go b/power/models/network_port.go index 226bb26a..360de77a 100644 --- a/power/models/network_port.go +++ b/power/models/network_port.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // NetworkPort network port +// // swagger:model NetworkPort type NetworkPort struct { @@ -118,7 +120,6 @@ func (m *NetworkPort) validatePortID(formats strfmt.Registry) error { } func (m *NetworkPort) validatePvmInstance(formats strfmt.Registry) error { - if swag.IsZero(m.PvmInstance) { // not required return nil } @@ -127,6 +128,8 @@ func (m *NetworkPort) validatePvmInstance(formats strfmt.Registry) error { if err := m.PvmInstance.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("pvmInstance") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("pvmInstance") } return err } @@ -144,6 +147,36 @@ func (m *NetworkPort) validateStatus(formats strfmt.Registry) error { return nil } +// ContextValidate validate this network port based on the context it is used +func (m *NetworkPort) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePvmInstance(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkPort) contextValidatePvmInstance(ctx context.Context, formats strfmt.Registry) error { + + if m.PvmInstance != nil { + if err := m.PvmInstance.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pvmInstance") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("pvmInstance") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *NetworkPort) MarshalBinary() ([]byte, error) { if m == nil { @@ -163,6 +196,7 @@ func (m *NetworkPort) UnmarshalBinary(b []byte) error { } // NetworkPortPvmInstance The attached pvm-instance to this port +// // swagger:model NetworkPortPvmInstance type NetworkPortPvmInstance struct { @@ -178,6 +212,11 @@ func (m *NetworkPortPvmInstance) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this network port pvm instance based on context it is used +func (m *NetworkPortPvmInstance) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *NetworkPortPvmInstance) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/network_port_create.go b/power/models/network_port_create.go index c477d585..d9c99e85 100644 --- a/power/models/network_port_create.go +++ b/power/models/network_port_create.go @@ -6,12 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // NetworkPortCreate network port create +// // swagger:model NetworkPortCreate type NetworkPortCreate struct { @@ -27,6 +29,11 @@ func (m *NetworkPortCreate) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this network port create based on context it is used +func (m *NetworkPortCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *NetworkPortCreate) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/network_port_update.go b/power/models/network_port_update.go index 63f0d2e7..6b438efb 100644 --- a/power/models/network_port_update.go +++ b/power/models/network_port_update.go @@ -6,12 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // NetworkPortUpdate network port update +// // swagger:model NetworkPortUpdate type NetworkPortUpdate struct { @@ -27,6 +29,11 @@ func (m *NetworkPortUpdate) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this network port update based on context it is used +func (m *NetworkPortUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *NetworkPortUpdate) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/network_ports.go b/power/models/network_ports.go index 5fe68913..78f26b22 100644 --- a/power/models/network_ports.go +++ b/power/models/network_ports.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // NetworkPorts network ports +// // swagger:model NetworkPorts type NetworkPorts struct { @@ -53,6 +54,42 @@ func (m *NetworkPorts) validatePorts(formats strfmt.Registry) error { if err := m.Ports[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("ports" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ports" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this network ports based on the context it is used +func (m *NetworkPorts) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePorts(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkPorts) contextValidatePorts(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Ports); i++ { + + if m.Ports[i] != nil { + if err := m.Ports[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ports" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ports" + "." + strconv.Itoa(i)) } return err } diff --git a/power/models/network_reference.go b/power/models/network_reference.go index 1f455e95..0398445e 100644 --- a/power/models/network_reference.go +++ b/power/models/network_reference.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // NetworkReference network reference +// // swagger:model NetworkReference type NetworkReference struct { @@ -135,13 +136,13 @@ const ( // NetworkReferenceTypeVlan captures enum value "vlan" NetworkReferenceTypeVlan string = "vlan" - // NetworkReferenceTypePubVlan captures enum value "pub-vlan" - NetworkReferenceTypePubVlan string = "pub-vlan" + // NetworkReferenceTypePubDashVlan captures enum value "pub-vlan" + NetworkReferenceTypePubDashVlan string = "pub-vlan" ) // prop value enum func (m *NetworkReference) validateTypeEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, networkReferenceTypeTypePropEnum); err != nil { + if err := validate.EnumCase(path, location, value, networkReferenceTypeTypePropEnum, true); err != nil { return err } return nil @@ -170,6 +171,11 @@ func (m *NetworkReference) validateVlanID(formats strfmt.Registry) error { return nil } +// ContextValidate validates this network reference based on context it is used +func (m *NetworkReference) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *NetworkReference) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/network_update.go b/power/models/network_update.go index 786eff03..af849c48 100644 --- a/power/models/network_update.go +++ b/power/models/network_update.go @@ -6,15 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // NetworkUpdate network update +// // swagger:model NetworkUpdate type NetworkUpdate struct { @@ -46,7 +47,6 @@ func (m *NetworkUpdate) Validate(formats strfmt.Registry) error { } func (m *NetworkUpdate) validateIPAddressRanges(formats strfmt.Registry) error { - if swag.IsZero(m.IPAddressRanges) { // not required return nil } @@ -60,6 +60,42 @@ func (m *NetworkUpdate) validateIPAddressRanges(formats strfmt.Registry) error { if err := m.IPAddressRanges[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("ipAddressRanges" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipAddressRanges" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this network update based on the context it is used +func (m *NetworkUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateIPAddressRanges(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkUpdate) contextValidateIPAddressRanges(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.IPAddressRanges); i++ { + + if m.IPAddressRanges[i] != nil { + if err := m.IPAddressRanges[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ipAddressRanges" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipAddressRanges" + "." + strconv.Itoa(i)) } return err } diff --git a/power/models/networks.go b/power/models/networks.go index 416a86b5..42428ee3 100644 --- a/power/models/networks.go +++ b/power/models/networks.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Networks networks +// // swagger:model Networks type Networks struct { @@ -53,6 +54,42 @@ func (m *Networks) validateNetworks(formats strfmt.Registry) error { if err := m.Networks[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("networks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this networks based on the context it is used +func (m *Networks) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateNetworks(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Networks) contextValidateNetworks(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Networks); i++ { + + if m.Networks[i] != nil { + if err := m.Networks[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networks" + "." + strconv.Itoa(i)) } return err } diff --git a/power/models/object.go b/power/models/object.go index 313a24e9..cf28d25e 100644 --- a/power/models/object.go +++ b/power/models/object.go @@ -6,5 +6,6 @@ package models // Editing this file might prove futile when you re-run the swagger generate command // Object object +// // swagger:model Object type Object interface{} diff --git a/power/models/open_stack.go b/power/models/open_stack.go index 5c5ba92b..6654773e 100644 --- a/power/models/open_stack.go +++ b/power/models/open_stack.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // OpenStack open stack +// // swagger:model OpenStack type OpenStack struct { @@ -113,6 +115,11 @@ func (m *OpenStack) validateRegion(formats strfmt.Registry) error { return nil } +// ContextValidate validates this open stack based on context it is used +func (m *OpenStack) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *OpenStack) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/open_stack_create.go b/power/models/open_stack_create.go index f86cb6cc..9c63f292 100644 --- a/power/models/open_stack_create.go +++ b/power/models/open_stack_create.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // OpenStackCreate open stack create +// // swagger:model OpenStackCreate type OpenStackCreate struct { @@ -79,6 +81,11 @@ func (m *OpenStackCreate) validateRegion(formats strfmt.Registry) error { return nil } +// ContextValidate validates this open stack create based on context it is used +func (m *OpenStackCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *OpenStackCreate) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/open_stack_info.go b/power/models/open_stack_info.go index 35967931..b98ee976 100644 --- a/power/models/open_stack_info.go +++ b/power/models/open_stack_info.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // OpenStackInfo open stack info +// // swagger:model OpenStackInfo type OpenStackInfo struct { @@ -61,6 +62,8 @@ func (m *OpenStackInfo) validateHosts(formats strfmt.Registry) error { if err := m.Hosts[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("hosts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("hosts" + "." + strconv.Itoa(i)) } return err } @@ -80,6 +83,40 @@ func (m *OpenStackInfo) validateRegion(formats strfmt.Registry) error { return nil } +// ContextValidate validate this open stack info based on the context it is used +func (m *OpenStackInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateHosts(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *OpenStackInfo) contextValidateHosts(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Hosts); i++ { + + if m.Hosts[i] != nil { + if err := m.Hosts[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("hosts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("hosts" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *OpenStackInfo) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/open_stacks.go b/power/models/open_stacks.go index 701a0fce..3b4c5265 100644 --- a/power/models/open_stacks.go +++ b/power/models/open_stacks.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // OpenStacks open stacks +// // swagger:model OpenStacks type OpenStacks struct { @@ -53,6 +54,42 @@ func (m *OpenStacks) validateOpenStacks(formats strfmt.Registry) error { if err := m.OpenStacks[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("openStacks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("openStacks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this open stacks based on the context it is used +func (m *OpenStacks) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateOpenStacks(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *OpenStacks) contextValidateOpenStacks(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.OpenStacks); i++ { + + if m.OpenStacks[i] != nil { + if err := m.OpenStacks[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("openStacks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("openStacks" + "." + strconv.Itoa(i)) } return err } diff --git a/power/models/operation.go b/power/models/operation.go index a238a976..3423d9e7 100644 --- a/power/models/operation.go +++ b/power/models/operation.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Operation operation +// // swagger:model Operation type Operation struct { @@ -79,6 +81,11 @@ func (m *Operation) validateTarget(formats strfmt.Registry) error { return nil } +// ContextValidate validates this operation based on context it is used +func (m *Operation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Operation) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/operations.go b/power/models/operations.go index a64afc1e..4c2d8b08 100644 --- a/power/models/operations.go +++ b/power/models/operations.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Operations operations +// // swagger:model Operations type Operations struct { @@ -83,14 +84,13 @@ const ( // prop value enum func (m *Operations) validateBootModeEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, operationsTypeBootModePropEnum); err != nil { + if err := validate.EnumCase(path, location, value, operationsTypeBootModePropEnum, true); err != nil { return err } return nil } func (m *Operations) validateBootMode(formats strfmt.Registry) error { - if swag.IsZero(m.BootMode) { // not required return nil } @@ -126,14 +126,13 @@ const ( // prop value enum func (m *Operations) validateOperatingModeEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, operationsTypeOperatingModePropEnum); err != nil { + if err := validate.EnumCase(path, location, value, operationsTypeOperatingModePropEnum, true); err != nil { return err } return nil } func (m *Operations) validateOperatingMode(formats strfmt.Registry) error { - if swag.IsZero(m.OperatingMode) { // not required return nil } @@ -187,14 +186,13 @@ const ( // prop value enum func (m *Operations) validateTaskEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, operationsTypeTaskPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, operationsTypeTaskPropEnum, true); err != nil { return err } return nil } func (m *Operations) validateTask(formats strfmt.Registry) error { - if swag.IsZero(m.Task) { // not required return nil } @@ -207,6 +205,11 @@ func (m *Operations) validateTask(formats strfmt.Registry) error { return nil } +// ContextValidate validates this operations based on context it is used +func (m *Operations) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Operations) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/options.go b/power/models/options.go index bc50247f..f0738536 100644 --- a/power/models/options.go +++ b/power/models/options.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Options options +// // swagger:model Options type Options struct { @@ -46,6 +48,38 @@ func (m *Options) validateVpnaasOptions(formats strfmt.Registry) error { if err := m.VpnaasOptions.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("vpnaasOptions") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vpnaasOptions") + } + return err + } + } + + return nil +} + +// ContextValidate validate this options based on the context it is used +func (m *Options) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateVpnaasOptions(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Options) contextValidateVpnaasOptions(ctx context.Context, formats strfmt.Registry) error { + + if m.VpnaasOptions != nil { + if err := m.VpnaasOptions.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vpnaasOptions") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vpnaasOptions") } return err } diff --git a/power/models/owner_info.go b/power/models/owner_info.go index fecd2046..3ed158c4 100644 --- a/power/models/owner_info.go +++ b/power/models/owner_info.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // OwnerInfo owner info +// // swagger:model OwnerInfo type OwnerInfo struct { @@ -44,7 +45,7 @@ type OwnerInfo struct { Name *string `json:"name"` // (deprecated - replaced by softlayerSubscriptions) Array of Soft Layer IDs - SoftlayerIds []string `json:"softlayerIDs"` + SoftlayerIDs []string `json:"softlayerIDs"` // Array of softlayer subscriptions // Required: true @@ -166,6 +167,8 @@ func (m *OwnerInfo) validateSoftlayerSubscriptions(formats strfmt.Registry) erro if err := m.SoftlayerSubscriptions[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("softlayerSubscriptions" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("softlayerSubscriptions" + "." + strconv.Itoa(i)) } return err } @@ -185,6 +188,40 @@ func (m *OwnerInfo) validateUserID(formats strfmt.Registry) error { return nil } +// ContextValidate validate this owner info based on the context it is used +func (m *OwnerInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateSoftlayerSubscriptions(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *OwnerInfo) contextValidateSoftlayerSubscriptions(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.SoftlayerSubscriptions); i++ { + + if m.SoftlayerSubscriptions[i] != nil { + if err := m.SoftlayerSubscriptions[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("softlayerSubscriptions" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("softlayerSubscriptions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *OwnerInfo) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/p_vm_instance.go b/power/models/p_vm_instance.go index e2816800..5e0a9f10 100644 --- a/power/models/p_vm_instance.go +++ b/power/models/p_vm_instance.go @@ -6,17 +6,18 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PVMInstance p VM instance +// // swagger:model PVMInstance type PVMInstance struct { @@ -71,7 +72,7 @@ type PVMInstance struct { // (deprecated - replaced by networks) List of Network IDs // Required: true - NetworkIds []string `json:"networkIDs"` + NetworkIDs []string `json:"networkIDs"` // The pvm instance networks information Networks []*PVMInstanceNetwork `json:"networks"` @@ -144,7 +145,7 @@ type PVMInstance struct { // List of volume IDs // Required: true - VolumeIds []string `json:"volumeIDs"` + VolumeIDs []string `json:"volumeIDs"` } // Validate validates this p VM instance @@ -183,7 +184,7 @@ func (m *PVMInstance) Validate(formats strfmt.Registry) error { res = append(res, err) } - if err := m.validateNetworkIds(formats); err != nil { + if err := m.validateNetworkIDs(formats); err != nil { res = append(res, err) } @@ -239,7 +240,7 @@ func (m *PVMInstance) Validate(formats strfmt.Registry) error { res = append(res, err) } - if err := m.validateVolumeIds(formats); err != nil { + if err := m.validateVolumeIDs(formats); err != nil { res = append(res, err) } @@ -250,7 +251,6 @@ func (m *PVMInstance) Validate(formats strfmt.Registry) error { } func (m *PVMInstance) validateAddresses(formats strfmt.Registry) error { - if swag.IsZero(m.Addresses) { // not required return nil } @@ -264,6 +264,8 @@ func (m *PVMInstance) validateAddresses(formats strfmt.Registry) error { if err := m.Addresses[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("addresses" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("addresses" + "." + strconv.Itoa(i)) } return err } @@ -275,7 +277,6 @@ func (m *PVMInstance) validateAddresses(formats strfmt.Registry) error { } func (m *PVMInstance) validateConsoleLanguage(formats strfmt.Registry) error { - if swag.IsZero(m.ConsoleLanguage) { // not required return nil } @@ -284,6 +285,8 @@ func (m *PVMInstance) validateConsoleLanguage(formats strfmt.Registry) error { if err := m.ConsoleLanguage.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("consoleLanguage") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("consoleLanguage") } return err } @@ -293,7 +296,6 @@ func (m *PVMInstance) validateConsoleLanguage(formats strfmt.Registry) error { } func (m *PVMInstance) validateCreationDate(formats strfmt.Registry) error { - if swag.IsZero(m.CreationDate) { // not required return nil } @@ -315,7 +317,6 @@ func (m *PVMInstance) validateDiskSize(formats strfmt.Registry) error { } func (m *PVMInstance) validateFault(formats strfmt.Registry) error { - if swag.IsZero(m.Fault) { // not required return nil } @@ -324,6 +325,8 @@ func (m *PVMInstance) validateFault(formats strfmt.Registry) error { if err := m.Fault.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("fault") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("fault") } return err } @@ -333,7 +336,6 @@ func (m *PVMInstance) validateFault(formats strfmt.Registry) error { } func (m *PVMInstance) validateHealth(formats strfmt.Registry) error { - if swag.IsZero(m.Health) { // not required return nil } @@ -342,6 +344,8 @@ func (m *PVMInstance) validateHealth(formats strfmt.Registry) error { if err := m.Health.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("health") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("health") } return err } @@ -368,9 +372,9 @@ func (m *PVMInstance) validateMemory(formats strfmt.Registry) error { return nil } -func (m *PVMInstance) validateNetworkIds(formats strfmt.Registry) error { +func (m *PVMInstance) validateNetworkIDs(formats strfmt.Registry) error { - if err := validate.Required("networkIDs", "body", m.NetworkIds); err != nil { + if err := validate.Required("networkIDs", "body", m.NetworkIDs); err != nil { return err } @@ -378,7 +382,6 @@ func (m *PVMInstance) validateNetworkIds(formats strfmt.Registry) error { } func (m *PVMInstance) validateNetworks(formats strfmt.Registry) error { - if swag.IsZero(m.Networks) { // not required return nil } @@ -392,6 +395,8 @@ func (m *PVMInstance) validateNetworks(formats strfmt.Registry) error { if err := m.Networks[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("networks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networks" + "." + strconv.Itoa(i)) } return err } @@ -434,13 +439,13 @@ const ( // PVMInstanceProcTypeCapped captures enum value "capped" PVMInstanceProcTypeCapped string = "capped" - // PVMInstanceProcType captures enum value "" - PVMInstanceProcType string = "" + // PVMInstanceProcTypeEmpty captures enum value "" + PVMInstanceProcTypeEmpty string = "" ) // prop value enum func (m *PVMInstance) validateProcTypeEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, pVmInstanceTypeProcTypePropEnum); err != nil { + if err := validate.EnumCase(path, location, value, pVmInstanceTypeProcTypePropEnum, true); err != nil { return err } return nil @@ -479,7 +484,6 @@ func (m *PVMInstance) validatePvmInstanceID(formats strfmt.Registry) error { } func (m *PVMInstance) validateSapProfile(formats strfmt.Registry) error { - if swag.IsZero(m.SapProfile) { // not required return nil } @@ -488,6 +492,8 @@ func (m *PVMInstance) validateSapProfile(formats strfmt.Registry) error { if err := m.SapProfile.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("sapProfile") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sapProfile") } return err } @@ -506,7 +512,6 @@ func (m *PVMInstance) validateServerName(formats strfmt.Registry) error { } func (m *PVMInstance) validateSoftwareLicenses(formats strfmt.Registry) error { - if swag.IsZero(m.SoftwareLicenses) { // not required return nil } @@ -515,6 +520,8 @@ func (m *PVMInstance) validateSoftwareLicenses(formats strfmt.Registry) error { if err := m.SoftwareLicenses.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("softwareLicenses") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("softwareLicenses") } return err } @@ -524,7 +531,6 @@ func (m *PVMInstance) validateSoftwareLicenses(formats strfmt.Registry) error { } func (m *PVMInstance) validateSrcs(formats strfmt.Registry) error { - if swag.IsZero(m.Srcs) { // not required return nil } @@ -540,6 +546,8 @@ func (m *PVMInstance) validateSrcs(formats strfmt.Registry) error { if err := m.Srcs[i][ii].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("srcs" + "." + strconv.Itoa(i) + "." + strconv.Itoa(ii)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("srcs" + "." + strconv.Itoa(i) + "." + strconv.Itoa(ii)) } return err } @@ -571,7 +579,6 @@ func (m *PVMInstance) validateStorageType(formats strfmt.Registry) error { } func (m *PVMInstance) validateUpdatedDate(formats strfmt.Registry) error { - if swag.IsZero(m.UpdatedDate) { // not required return nil } @@ -584,7 +591,6 @@ func (m *PVMInstance) validateUpdatedDate(formats strfmt.Registry) error { } func (m *PVMInstance) validateVirtualCores(formats strfmt.Registry) error { - if swag.IsZero(m.VirtualCores) { // not required return nil } @@ -593,6 +599,8 @@ func (m *PVMInstance) validateVirtualCores(formats strfmt.Registry) error { if err := m.VirtualCores.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("virtualCores") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("virtualCores") } return err } @@ -601,15 +609,221 @@ func (m *PVMInstance) validateVirtualCores(formats strfmt.Registry) error { return nil } -func (m *PVMInstance) validateVolumeIds(formats strfmt.Registry) error { +func (m *PVMInstance) validateVolumeIDs(formats strfmt.Registry) error { - if err := validate.Required("volumeIDs", "body", m.VolumeIds); err != nil { + if err := validate.Required("volumeIDs", "body", m.VolumeIDs); err != nil { return err } return nil } +// ContextValidate validate this p VM instance based on the context it is used +func (m *PVMInstance) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAddresses(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateConsoleLanguage(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateFault(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateHealth(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateNetworks(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSapProfile(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSoftwareLicenses(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSrcs(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateVirtualCores(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PVMInstance) contextValidateAddresses(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Addresses); i++ { + + if m.Addresses[i] != nil { + if err := m.Addresses[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("addresses" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("addresses" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PVMInstance) contextValidateConsoleLanguage(ctx context.Context, formats strfmt.Registry) error { + + if m.ConsoleLanguage != nil { + if err := m.ConsoleLanguage.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("consoleLanguage") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("consoleLanguage") + } + return err + } + } + + return nil +} + +func (m *PVMInstance) contextValidateFault(ctx context.Context, formats strfmt.Registry) error { + + if m.Fault != nil { + if err := m.Fault.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fault") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("fault") + } + return err + } + } + + return nil +} + +func (m *PVMInstance) contextValidateHealth(ctx context.Context, formats strfmt.Registry) error { + + if m.Health != nil { + if err := m.Health.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("health") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("health") + } + return err + } + } + + return nil +} + +func (m *PVMInstance) contextValidateNetworks(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Networks); i++ { + + if m.Networks[i] != nil { + if err := m.Networks[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PVMInstance) contextValidateSapProfile(ctx context.Context, formats strfmt.Registry) error { + + if m.SapProfile != nil { + if err := m.SapProfile.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sapProfile") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sapProfile") + } + return err + } + } + + return nil +} + +func (m *PVMInstance) contextValidateSoftwareLicenses(ctx context.Context, formats strfmt.Registry) error { + + if m.SoftwareLicenses != nil { + if err := m.SoftwareLicenses.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("softwareLicenses") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("softwareLicenses") + } + return err + } + } + + return nil +} + +func (m *PVMInstance) contextValidateSrcs(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Srcs); i++ { + + for ii := 0; ii < len(m.Srcs[i]); ii++ { + + if m.Srcs[i][ii] != nil { + if err := m.Srcs[i][ii].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("srcs" + "." + strconv.Itoa(i) + "." + strconv.Itoa(ii)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("srcs" + "." + strconv.Itoa(i) + "." + strconv.Itoa(ii)) + } + return err + } + } + + } + + } + + return nil +} + +func (m *PVMInstance) contextValidateVirtualCores(ctx context.Context, formats strfmt.Registry) error { + + if m.VirtualCores != nil { + if err := m.VirtualCores.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("virtualCores") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("virtualCores") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PVMInstance) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/p_vm_instance_action.go b/power/models/p_vm_instance_action.go index 6a6cc668..3c927919 100644 --- a/power/models/p_vm_instance_action.go +++ b/power/models/p_vm_instance_action.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PVMInstanceAction p VM instance action +// // swagger:model PVMInstanceAction type PVMInstanceAction struct { @@ -59,22 +60,22 @@ const ( // PVMInstanceActionActionStop captures enum value "stop" PVMInstanceActionActionStop string = "stop" - // PVMInstanceActionActionImmediateShutdown captures enum value "immediate-shutdown" - PVMInstanceActionActionImmediateShutdown string = "immediate-shutdown" + // PVMInstanceActionActionImmediateDashShutdown captures enum value "immediate-shutdown" + PVMInstanceActionActionImmediateDashShutdown string = "immediate-shutdown" - // PVMInstanceActionActionHardReboot captures enum value "hard-reboot" - PVMInstanceActionActionHardReboot string = "hard-reboot" + // PVMInstanceActionActionHardDashReboot captures enum value "hard-reboot" + PVMInstanceActionActionHardDashReboot string = "hard-reboot" - // PVMInstanceActionActionSoftReboot captures enum value "soft-reboot" - PVMInstanceActionActionSoftReboot string = "soft-reboot" + // PVMInstanceActionActionSoftDashReboot captures enum value "soft-reboot" + PVMInstanceActionActionSoftDashReboot string = "soft-reboot" - // PVMInstanceActionActionResetState captures enum value "reset-state" - PVMInstanceActionActionResetState string = "reset-state" + // PVMInstanceActionActionResetDashState captures enum value "reset-state" + PVMInstanceActionActionResetDashState string = "reset-state" ) // prop value enum func (m *PVMInstanceAction) validateActionEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, pVmInstanceActionTypeActionPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, pVmInstanceActionTypeActionPropEnum, true); err != nil { return err } return nil @@ -94,6 +95,11 @@ func (m *PVMInstanceAction) validateAction(formats strfmt.Registry) error { return nil } +// ContextValidate validates this p VM instance action based on context it is used +func (m *PVMInstanceAction) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PVMInstanceAction) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/p_vm_instance_add_network.go b/power/models/p_vm_instance_add_network.go index 8d0bc58e..d0c9f756 100644 --- a/power/models/p_vm_instance_add_network.go +++ b/power/models/p_vm_instance_add_network.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PVMInstanceAddNetwork p VM instance add network +// // swagger:model PVMInstanceAddNetwork type PVMInstanceAddNetwork struct { @@ -48,6 +50,11 @@ func (m *PVMInstanceAddNetwork) validateNetworkID(formats strfmt.Registry) error return nil } +// ContextValidate validates this p VM instance add network based on context it is used +func (m *PVMInstanceAddNetwork) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PVMInstanceAddNetwork) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/p_vm_instance_address.go b/power/models/p_vm_instance_address.go index 3cff8dad..2e7ad6b9 100644 --- a/power/models/p_vm_instance_address.go +++ b/power/models/p_vm_instance_address.go @@ -6,12 +6,15 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // PVMInstanceAddress deprecated - replaced by PVMInstanceNetwork +// // swagger:model PVMInstanceAddress type PVMInstanceAddress struct { PVMInstanceNetwork @@ -38,7 +41,6 @@ func (m PVMInstanceAddress) MarshalJSON() ([]byte, error) { return nil, err } _parts = append(_parts, aO0) - return swag.ConcatJSON(_parts...), nil } @@ -47,20 +49,17 @@ func (m *PVMInstanceAddress) Validate(formats strfmt.Registry) error { return nil } -// MarshalBinary interface implementation -func (m *PVMInstanceAddress) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil +// ContextValidate validate this p VM instance address based on the context it is used +func (m *PVMInstanceAddress) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with PVMInstanceNetwork + if err := m.PVMInstanceNetwork.ContextValidate(ctx, formats); err != nil { + res = append(res, err) } - return swag.WriteJSON(m) -} -// UnmarshalBinary interface implementation -func (m *PVMInstanceAddress) UnmarshalBinary(b []byte) error { - var res PVMInstanceAddress - if err := swag.ReadJSON(b, &res); err != nil { - return err + if len(res) > 0 { + return errors.CompositeValidationError(res...) } - *m = res return nil } diff --git a/power/models/p_vm_instance_capture.go b/power/models/p_vm_instance_capture.go index c33e6451..7f925c28 100644 --- a/power/models/p_vm_instance_capture.go +++ b/power/models/p_vm_instance_capture.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PVMInstanceCapture p VM instance capture +// // swagger:model PVMInstanceCapture type PVMInstanceCapture struct { @@ -29,7 +30,7 @@ type PVMInstanceCapture struct { CaptureName *string `json:"captureName"` // List of Data volume IDs to include in the captured PVMInstance - CaptureVolumeIds []string `json:"captureVolumeIDs"` + CaptureVolumeIDs []string `json:"captureVolumeIDs"` // Cloud Storage Access key CloudStorageAccessKey string `json:"cloudStorageAccessKey,omitempty"` @@ -76,11 +77,11 @@ func init() { const ( - // PVMInstanceCaptureCaptureDestinationImageCatalog captures enum value "image-catalog" - PVMInstanceCaptureCaptureDestinationImageCatalog string = "image-catalog" + // PVMInstanceCaptureCaptureDestinationImageDashCatalog captures enum value "image-catalog" + PVMInstanceCaptureCaptureDestinationImageDashCatalog string = "image-catalog" - // PVMInstanceCaptureCaptureDestinationCloudStorage captures enum value "cloud-storage" - PVMInstanceCaptureCaptureDestinationCloudStorage string = "cloud-storage" + // PVMInstanceCaptureCaptureDestinationCloudDashStorage captures enum value "cloud-storage" + PVMInstanceCaptureCaptureDestinationCloudDashStorage string = "cloud-storage" // PVMInstanceCaptureCaptureDestinationBoth captures enum value "both" PVMInstanceCaptureCaptureDestinationBoth string = "both" @@ -88,7 +89,7 @@ const ( // prop value enum func (m *PVMInstanceCapture) validateCaptureDestinationEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, pVmInstanceCaptureTypeCaptureDestinationPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, pVmInstanceCaptureTypeCaptureDestinationPropEnum, true); err != nil { return err } return nil @@ -117,6 +118,11 @@ func (m *PVMInstanceCapture) validateCaptureName(formats strfmt.Registry) error return nil } +// ContextValidate validates this p VM instance capture based on context it is used +func (m *PVMInstanceCapture) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PVMInstanceCapture) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/p_vm_instance_clone.go b/power/models/p_vm_instance_clone.go index bad6a5be..c517f970 100644 --- a/power/models/p_vm_instance_clone.go +++ b/power/models/p_vm_instance_clone.go @@ -6,17 +6,18 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PVMInstanceClone p VM instance clone +// // swagger:model PVMInstanceClone type PVMInstanceClone struct { @@ -45,7 +46,7 @@ type PVMInstanceClone struct { SoftwareLicenses *SoftwareLicenses `json:"softwareLicenses,omitempty"` // List of volume IDs - VolumeIds []string `json:"volumeIDs"` + VolumeIDs []string `json:"volumeIDs"` } // Validate validates this p VM instance clone @@ -98,6 +99,8 @@ func (m *PVMInstanceClone) validateNetworks(formats strfmt.Registry) error { if err := m.Networks[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("networks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networks" + "." + strconv.Itoa(i)) } return err } @@ -134,14 +137,13 @@ const ( // prop value enum func (m *PVMInstanceClone) validateProcTypeEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, pVmInstanceCloneTypeProcTypePropEnum); err != nil { + if err := validate.EnumCase(path, location, value, pVmInstanceCloneTypeProcTypePropEnum, true); err != nil { return err } return nil } func (m *PVMInstanceClone) validateProcType(formats strfmt.Registry) error { - if swag.IsZero(m.ProcType) { // not required return nil } @@ -155,7 +157,6 @@ func (m *PVMInstanceClone) validateProcType(formats strfmt.Registry) error { } func (m *PVMInstanceClone) validateSoftwareLicenses(formats strfmt.Registry) error { - if swag.IsZero(m.SoftwareLicenses) { // not required return nil } @@ -164,6 +165,62 @@ func (m *PVMInstanceClone) validateSoftwareLicenses(formats strfmt.Registry) err if err := m.SoftwareLicenses.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("softwareLicenses") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("softwareLicenses") + } + return err + } + } + + return nil +} + +// ContextValidate validate this p VM instance clone based on the context it is used +func (m *PVMInstanceClone) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateNetworks(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSoftwareLicenses(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PVMInstanceClone) contextValidateNetworks(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Networks); i++ { + + if m.Networks[i] != nil { + if err := m.Networks[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PVMInstanceClone) contextValidateSoftwareLicenses(ctx context.Context, formats strfmt.Registry) error { + + if m.SoftwareLicenses != nil { + if err := m.SoftwareLicenses.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("softwareLicenses") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("softwareLicenses") } return err } diff --git a/power/models/p_vm_instance_console.go b/power/models/p_vm_instance_console.go index 62face87..0ed92109 100644 --- a/power/models/p_vm_instance_console.go +++ b/power/models/p_vm_instance_console.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PVMInstanceConsole p VM instance console +// // swagger:model PVMInstanceConsole type PVMInstanceConsole struct { @@ -45,6 +47,11 @@ func (m *PVMInstanceConsole) validateConsoleURL(formats strfmt.Registry) error { return nil } +// ContextValidate validates this p VM instance console based on context it is used +func (m *PVMInstanceConsole) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PVMInstanceConsole) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/p_vm_instance_create.go b/power/models/p_vm_instance_create.go index 41d964cb..c5bcc104 100644 --- a/power/models/p_vm_instance_create.go +++ b/power/models/p_vm_instance_create.go @@ -6,17 +6,18 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PVMInstanceCreate p VM instance create +// // swagger:model PVMInstanceCreate type PVMInstanceCreate struct { @@ -38,7 +39,7 @@ type PVMInstanceCreate struct { Migratable *bool `json:"migratable,omitempty"` // (deprecated - replaced by networks) List of Network IDs - NetworkIds []string `json:"networkIDs"` + NetworkIDs []string `json:"networkIDs"` // The pvm instance networks information Networks []*PVMInstanceAddNetwork `json:"networks"` @@ -99,7 +100,7 @@ type PVMInstanceCreate struct { VirtualCores *VirtualCores `json:"virtualCores,omitempty"` // List of volume IDs - VolumeIds []string `json:"volumeIDs"` + VolumeIDs []string `json:"volumeIDs"` } // Validate validates this p VM instance create @@ -183,7 +184,6 @@ func (m *PVMInstanceCreate) validateMemory(formats strfmt.Registry) error { } func (m *PVMInstanceCreate) validateNetworks(formats strfmt.Registry) error { - if swag.IsZero(m.Networks) { // not required return nil } @@ -197,6 +197,8 @@ func (m *PVMInstanceCreate) validateNetworks(formats strfmt.Registry) error { if err := m.Networks[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("networks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networks" + "." + strconv.Itoa(i)) } return err } @@ -208,7 +210,6 @@ func (m *PVMInstanceCreate) validateNetworks(formats strfmt.Registry) error { } func (m *PVMInstanceCreate) validatePinPolicy(formats strfmt.Registry) error { - if swag.IsZero(m.PinPolicy) { // not required return nil } @@ -216,6 +217,8 @@ func (m *PVMInstanceCreate) validatePinPolicy(formats strfmt.Registry) error { if err := m.PinPolicy.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("pinPolicy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("pinPolicy") } return err } @@ -249,7 +252,7 @@ const ( // prop value enum func (m *PVMInstanceCreate) validateProcTypeEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, pVmInstanceCreateTypeProcTypePropEnum); err != nil { + if err := validate.EnumCase(path, location, value, pVmInstanceCreateTypeProcTypePropEnum, true); err != nil { return err } return nil @@ -295,8 +298,8 @@ const ( // PVMInstanceCreateReplicantAffinityPolicyAffinity captures enum value "affinity" PVMInstanceCreateReplicantAffinityPolicyAffinity string = "affinity" - // PVMInstanceCreateReplicantAffinityPolicyAntiAffinity captures enum value "anti-affinity" - PVMInstanceCreateReplicantAffinityPolicyAntiAffinity string = "anti-affinity" + // PVMInstanceCreateReplicantAffinityPolicyAntiDashAffinity captures enum value "anti-affinity" + PVMInstanceCreateReplicantAffinityPolicyAntiDashAffinity string = "anti-affinity" // PVMInstanceCreateReplicantAffinityPolicyNone captures enum value "none" PVMInstanceCreateReplicantAffinityPolicyNone string = "none" @@ -304,14 +307,13 @@ const ( // prop value enum func (m *PVMInstanceCreate) validateReplicantAffinityPolicyEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, pVmInstanceCreateTypeReplicantAffinityPolicyPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, pVmInstanceCreateTypeReplicantAffinityPolicyPropEnum, true); err != nil { return err } return nil } func (m *PVMInstanceCreate) validateReplicantAffinityPolicy(formats strfmt.Registry) error { - if swag.IsZero(m.ReplicantAffinityPolicy) { // not required return nil } @@ -347,14 +349,13 @@ const ( // prop value enum func (m *PVMInstanceCreate) validateReplicantNamingSchemeEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, pVmInstanceCreateTypeReplicantNamingSchemePropEnum); err != nil { + if err := validate.EnumCase(path, location, value, pVmInstanceCreateTypeReplicantNamingSchemePropEnum, true); err != nil { return err } return nil } func (m *PVMInstanceCreate) validateReplicantNamingScheme(formats strfmt.Registry) error { - if swag.IsZero(m.ReplicantNamingScheme) { // not required return nil } @@ -377,7 +378,6 @@ func (m *PVMInstanceCreate) validateServerName(formats strfmt.Registry) error { } func (m *PVMInstanceCreate) validateSoftwareLicenses(formats strfmt.Registry) error { - if swag.IsZero(m.SoftwareLicenses) { // not required return nil } @@ -386,6 +386,8 @@ func (m *PVMInstanceCreate) validateSoftwareLicenses(formats strfmt.Registry) er if err := m.SoftwareLicenses.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("softwareLicenses") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("softwareLicenses") } return err } @@ -395,7 +397,6 @@ func (m *PVMInstanceCreate) validateSoftwareLicenses(formats strfmt.Registry) er } func (m *PVMInstanceCreate) validateStorageAffinity(formats strfmt.Registry) error { - if swag.IsZero(m.StorageAffinity) { // not required return nil } @@ -404,6 +405,8 @@ func (m *PVMInstanceCreate) validateStorageAffinity(formats strfmt.Registry) err if err := m.StorageAffinity.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("storageAffinity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("storageAffinity") } return err } @@ -432,14 +435,13 @@ const ( // prop value enum func (m *PVMInstanceCreate) validateStorageConnectionEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, pVmInstanceCreateTypeStorageConnectionPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, pVmInstanceCreateTypeStorageConnectionPropEnum, true); err != nil { return err } return nil } func (m *PVMInstanceCreate) validateStorageConnection(formats strfmt.Registry) error { - if swag.IsZero(m.StorageConnection) { // not required return nil } @@ -453,7 +455,6 @@ func (m *PVMInstanceCreate) validateStorageConnection(formats strfmt.Registry) e } func (m *PVMInstanceCreate) validateVirtualCores(formats strfmt.Registry) error { - if swag.IsZero(m.VirtualCores) { // not required return nil } @@ -462,6 +463,120 @@ func (m *PVMInstanceCreate) validateVirtualCores(formats strfmt.Registry) error if err := m.VirtualCores.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("virtualCores") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("virtualCores") + } + return err + } + } + + return nil +} + +// ContextValidate validate this p VM instance create based on the context it is used +func (m *PVMInstanceCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateNetworks(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePinPolicy(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSoftwareLicenses(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStorageAffinity(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateVirtualCores(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PVMInstanceCreate) contextValidateNetworks(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Networks); i++ { + + if m.Networks[i] != nil { + if err := m.Networks[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PVMInstanceCreate) contextValidatePinPolicy(ctx context.Context, formats strfmt.Registry) error { + + if err := m.PinPolicy.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pinPolicy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("pinPolicy") + } + return err + } + + return nil +} + +func (m *PVMInstanceCreate) contextValidateSoftwareLicenses(ctx context.Context, formats strfmt.Registry) error { + + if m.SoftwareLicenses != nil { + if err := m.SoftwareLicenses.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("softwareLicenses") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("softwareLicenses") + } + return err + } + } + + return nil +} + +func (m *PVMInstanceCreate) contextValidateStorageAffinity(ctx context.Context, formats strfmt.Registry) error { + + if m.StorageAffinity != nil { + if err := m.StorageAffinity.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("storageAffinity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("storageAffinity") + } + return err + } + } + + return nil +} + +func (m *PVMInstanceCreate) contextValidateVirtualCores(ctx context.Context, formats strfmt.Registry) error { + + if m.VirtualCores != nil { + if err := m.VirtualCores.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("virtualCores") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("virtualCores") } return err } diff --git a/power/models/p_vm_instance_fault.go b/power/models/p_vm_instance_fault.go index 0b5a25b3..bc5133e8 100644 --- a/power/models/p_vm_instance_fault.go +++ b/power/models/p_vm_instance_fault.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PVMInstanceFault Fault information (if occurred) +// // swagger:model PVMInstanceFault type PVMInstanceFault struct { @@ -46,7 +48,6 @@ func (m *PVMInstanceFault) Validate(formats strfmt.Registry) error { } func (m *PVMInstanceFault) validateCreated(formats strfmt.Registry) error { - if swag.IsZero(m.Created) { // not required return nil } @@ -58,6 +59,11 @@ func (m *PVMInstanceFault) validateCreated(formats strfmt.Registry) error { return nil } +// ContextValidate validates this p VM instance fault based on context it is used +func (m *PVMInstanceFault) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PVMInstanceFault) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/p_vm_instance_health.go b/power/models/p_vm_instance_health.go index 64e5731b..11c21c9a 100644 --- a/power/models/p_vm_instance_health.go +++ b/power/models/p_vm_instance_health.go @@ -6,12 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // PVMInstanceHealth PVM's health status details +// // swagger:model PVMInstanceHealth type PVMInstanceHealth struct { @@ -30,6 +32,11 @@ func (m *PVMInstanceHealth) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this p VM instance health based on context it is used +func (m *PVMInstanceHealth) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PVMInstanceHealth) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/p_vm_instance_list.go b/power/models/p_vm_instance_list.go index 489e0da3..2345d10d 100644 --- a/power/models/p_vm_instance_list.go +++ b/power/models/p_vm_instance_list.go @@ -6,15 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // PVMInstanceList A list of PVMInstances +// // swagger:model PVMInstanceList type PVMInstanceList []*PVMInstance @@ -31,6 +32,33 @@ func (m PVMInstanceList) Validate(formats strfmt.Registry) error { if err := m[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName(strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validate this p VM instance list based on the context it is used +func (m PVMInstanceList) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + + if m[i] != nil { + if err := m[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(strconv.Itoa(i)) } return err } diff --git a/power/models/p_vm_instance_multi_create.go b/power/models/p_vm_instance_multi_create.go index 800c2b90..682af222 100644 --- a/power/models/p_vm_instance_multi_create.go +++ b/power/models/p_vm_instance_multi_create.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PVMInstanceMultiCreate p VM instance multi create +// // swagger:model PVMInstanceMultiCreate type PVMInstanceMultiCreate struct { @@ -66,8 +67,8 @@ const ( // PVMInstanceMultiCreateAffinityPolicyAffinity captures enum value "affinity" PVMInstanceMultiCreateAffinityPolicyAffinity string = "affinity" - // PVMInstanceMultiCreateAffinityPolicyAntiAffinity captures enum value "anti-affinity" - PVMInstanceMultiCreateAffinityPolicyAntiAffinity string = "anti-affinity" + // PVMInstanceMultiCreateAffinityPolicyAntiDashAffinity captures enum value "anti-affinity" + PVMInstanceMultiCreateAffinityPolicyAntiDashAffinity string = "anti-affinity" // PVMInstanceMultiCreateAffinityPolicyNone captures enum value "none" PVMInstanceMultiCreateAffinityPolicyNone string = "none" @@ -75,14 +76,13 @@ const ( // prop value enum func (m *PVMInstanceMultiCreate) validateAffinityPolicyEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, pVmInstanceMultiCreateTypeAffinityPolicyPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, pVmInstanceMultiCreateTypeAffinityPolicyPropEnum, true); err != nil { return err } return nil } func (m *PVMInstanceMultiCreate) validateAffinityPolicy(formats strfmt.Registry) error { - if swag.IsZero(m.AffinityPolicy) { // not required return nil } @@ -118,14 +118,13 @@ const ( // prop value enum func (m *PVMInstanceMultiCreate) validateNumericalEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, pVmInstanceMultiCreateTypeNumericalPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, pVmInstanceMultiCreateTypeNumericalPropEnum, true); err != nil { return err } return nil } func (m *PVMInstanceMultiCreate) validateNumerical(formats strfmt.Registry) error { - if swag.IsZero(m.Numerical) { // not required return nil } @@ -138,6 +137,11 @@ func (m *PVMInstanceMultiCreate) validateNumerical(formats strfmt.Registry) erro return nil } +// ContextValidate validates this p VM instance multi create based on context it is used +func (m *PVMInstanceMultiCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PVMInstanceMultiCreate) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/p_vm_instance_network.go b/power/models/p_vm_instance_network.go index 5a9dfa18..94e64264 100644 --- a/power/models/p_vm_instance_network.go +++ b/power/models/p_vm_instance_network.go @@ -6,12 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // PVMInstanceNetwork A map containing information about a network address +// // swagger:model PVMInstanceNetwork type PVMInstanceNetwork struct { @@ -48,6 +50,11 @@ func (m *PVMInstanceNetwork) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this p VM instance network based on context it is used +func (m *PVMInstanceNetwork) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PVMInstanceNetwork) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/p_vm_instance_networks.go b/power/models/p_vm_instance_networks.go index 4ed2e3cf..e511b64d 100644 --- a/power/models/p_vm_instance_networks.go +++ b/power/models/p_vm_instance_networks.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PVMInstanceNetworks p VM instance networks +// // swagger:model PVMInstanceNetworks type PVMInstanceNetworks struct { @@ -53,6 +54,42 @@ func (m *PVMInstanceNetworks) validateNetworks(formats strfmt.Registry) error { if err := m.Networks[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("networks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this p VM instance networks based on the context it is used +func (m *PVMInstanceNetworks) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateNetworks(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PVMInstanceNetworks) contextValidateNetworks(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Networks); i++ { + + if m.Networks[i] != nil { + if err := m.Networks[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networks" + "." + strconv.Itoa(i)) } return err } diff --git a/power/models/p_vm_instance_operation.go b/power/models/p_vm_instance_operation.go index fe752989..f9c202e5 100644 --- a/power/models/p_vm_instance_operation.go +++ b/power/models/p_vm_instance_operation.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PVMInstanceOperation p VM instance operation +// // swagger:model PVMInstanceOperation type PVMInstanceOperation struct { @@ -57,6 +58,8 @@ func (m *PVMInstanceOperation) validateOperation(formats strfmt.Registry) error if err := m.Operation.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("operation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("operation") } return err } @@ -88,7 +91,7 @@ const ( // prop value enum func (m *PVMInstanceOperation) validateOperationTypeEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, pVmInstanceOperationTypeOperationTypePropEnum); err != nil { + if err := validate.EnumCase(path, location, value, pVmInstanceOperationTypeOperationTypePropEnum, true); err != nil { return err } return nil @@ -108,6 +111,36 @@ func (m *PVMInstanceOperation) validateOperationType(formats strfmt.Registry) er return nil } +// ContextValidate validate this p VM instance operation based on the context it is used +func (m *PVMInstanceOperation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateOperation(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PVMInstanceOperation) contextValidateOperation(ctx context.Context, formats strfmt.Registry) error { + + if m.Operation != nil { + if err := m.Operation.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("operation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("operation") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *PVMInstanceOperation) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/p_vm_instance_reference.go b/power/models/p_vm_instance_reference.go index b87b28b0..33303e9d 100644 --- a/power/models/p_vm_instance_reference.go +++ b/power/models/p_vm_instance_reference.go @@ -6,17 +6,18 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PVMInstanceReference p VM instance reference +// // swagger:model PVMInstanceReference type PVMInstanceReference struct { @@ -234,7 +235,6 @@ func (m *PVMInstanceReference) Validate(formats strfmt.Registry) error { } func (m *PVMInstanceReference) validateAddresses(formats strfmt.Registry) error { - if swag.IsZero(m.Addresses) { // not required return nil } @@ -248,6 +248,8 @@ func (m *PVMInstanceReference) validateAddresses(formats strfmt.Registry) error if err := m.Addresses[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("addresses" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("addresses" + "." + strconv.Itoa(i)) } return err } @@ -259,7 +261,6 @@ func (m *PVMInstanceReference) validateAddresses(formats strfmt.Registry) error } func (m *PVMInstanceReference) validateConsoleLanguage(formats strfmt.Registry) error { - if swag.IsZero(m.ConsoleLanguage) { // not required return nil } @@ -268,6 +269,8 @@ func (m *PVMInstanceReference) validateConsoleLanguage(formats strfmt.Registry) if err := m.ConsoleLanguage.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("consoleLanguage") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("consoleLanguage") } return err } @@ -277,7 +280,6 @@ func (m *PVMInstanceReference) validateConsoleLanguage(formats strfmt.Registry) } func (m *PVMInstanceReference) validateCreationDate(formats strfmt.Registry) error { - if swag.IsZero(m.CreationDate) { // not required return nil } @@ -299,7 +301,6 @@ func (m *PVMInstanceReference) validateDiskSize(formats strfmt.Registry) error { } func (m *PVMInstanceReference) validateFault(formats strfmt.Registry) error { - if swag.IsZero(m.Fault) { // not required return nil } @@ -308,6 +309,8 @@ func (m *PVMInstanceReference) validateFault(formats strfmt.Registry) error { if err := m.Fault.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("fault") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("fault") } return err } @@ -317,7 +320,6 @@ func (m *PVMInstanceReference) validateFault(formats strfmt.Registry) error { } func (m *PVMInstanceReference) validateHealth(formats strfmt.Registry) error { - if swag.IsZero(m.Health) { // not required return nil } @@ -326,6 +328,8 @@ func (m *PVMInstanceReference) validateHealth(formats strfmt.Registry) error { if err := m.Health.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("health") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("health") } return err } @@ -362,7 +366,6 @@ func (m *PVMInstanceReference) validateMemory(formats strfmt.Registry) error { } func (m *PVMInstanceReference) validateNetworks(formats strfmt.Registry) error { - if swag.IsZero(m.Networks) { // not required return nil } @@ -376,6 +379,8 @@ func (m *PVMInstanceReference) validateNetworks(formats strfmt.Registry) error { if err := m.Networks[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("networks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networks" + "." + strconv.Itoa(i)) } return err } @@ -421,7 +426,7 @@ const ( // prop value enum func (m *PVMInstanceReference) validateProcTypeEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, pVmInstanceReferenceTypeProcTypePropEnum); err != nil { + if err := validate.EnumCase(path, location, value, pVmInstanceReferenceTypeProcTypePropEnum, true); err != nil { return err } return nil @@ -460,7 +465,6 @@ func (m *PVMInstanceReference) validatePvmInstanceID(formats strfmt.Registry) er } func (m *PVMInstanceReference) validateSapProfile(formats strfmt.Registry) error { - if swag.IsZero(m.SapProfile) { // not required return nil } @@ -469,6 +473,8 @@ func (m *PVMInstanceReference) validateSapProfile(formats strfmt.Registry) error if err := m.SapProfile.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("sapProfile") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sapProfile") } return err } @@ -487,7 +493,6 @@ func (m *PVMInstanceReference) validateServerName(formats strfmt.Registry) error } func (m *PVMInstanceReference) validateSoftwareLicenses(formats strfmt.Registry) error { - if swag.IsZero(m.SoftwareLicenses) { // not required return nil } @@ -496,6 +501,8 @@ func (m *PVMInstanceReference) validateSoftwareLicenses(formats strfmt.Registry) if err := m.SoftwareLicenses.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("softwareLicenses") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("softwareLicenses") } return err } @@ -505,7 +512,6 @@ func (m *PVMInstanceReference) validateSoftwareLicenses(formats strfmt.Registry) } func (m *PVMInstanceReference) validateSrcs(formats strfmt.Registry) error { - if swag.IsZero(m.Srcs) { // not required return nil } @@ -521,6 +527,8 @@ func (m *PVMInstanceReference) validateSrcs(formats strfmt.Registry) error { if err := m.Srcs[i][ii].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("srcs" + "." + strconv.Itoa(i) + "." + strconv.Itoa(ii)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("srcs" + "." + strconv.Itoa(i) + "." + strconv.Itoa(ii)) } return err } @@ -543,7 +551,6 @@ func (m *PVMInstanceReference) validateStatus(formats strfmt.Registry) error { } func (m *PVMInstanceReference) validateUpdatedDate(formats strfmt.Registry) error { - if swag.IsZero(m.UpdatedDate) { // not required return nil } @@ -556,7 +563,6 @@ func (m *PVMInstanceReference) validateUpdatedDate(formats strfmt.Registry) erro } func (m *PVMInstanceReference) validateVirtualCores(formats strfmt.Registry) error { - if swag.IsZero(m.VirtualCores) { // not required return nil } @@ -565,6 +571,214 @@ func (m *PVMInstanceReference) validateVirtualCores(formats strfmt.Registry) err if err := m.VirtualCores.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("virtualCores") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("virtualCores") + } + return err + } + } + + return nil +} + +// ContextValidate validate this p VM instance reference based on the context it is used +func (m *PVMInstanceReference) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAddresses(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateConsoleLanguage(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateFault(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateHealth(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateNetworks(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSapProfile(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSoftwareLicenses(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSrcs(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateVirtualCores(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PVMInstanceReference) contextValidateAddresses(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Addresses); i++ { + + if m.Addresses[i] != nil { + if err := m.Addresses[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("addresses" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("addresses" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PVMInstanceReference) contextValidateConsoleLanguage(ctx context.Context, formats strfmt.Registry) error { + + if m.ConsoleLanguage != nil { + if err := m.ConsoleLanguage.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("consoleLanguage") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("consoleLanguage") + } + return err + } + } + + return nil +} + +func (m *PVMInstanceReference) contextValidateFault(ctx context.Context, formats strfmt.Registry) error { + + if m.Fault != nil { + if err := m.Fault.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fault") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("fault") + } + return err + } + } + + return nil +} + +func (m *PVMInstanceReference) contextValidateHealth(ctx context.Context, formats strfmt.Registry) error { + + if m.Health != nil { + if err := m.Health.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("health") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("health") + } + return err + } + } + + return nil +} + +func (m *PVMInstanceReference) contextValidateNetworks(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Networks); i++ { + + if m.Networks[i] != nil { + if err := m.Networks[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PVMInstanceReference) contextValidateSapProfile(ctx context.Context, formats strfmt.Registry) error { + + if m.SapProfile != nil { + if err := m.SapProfile.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sapProfile") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sapProfile") + } + return err + } + } + + return nil +} + +func (m *PVMInstanceReference) contextValidateSoftwareLicenses(ctx context.Context, formats strfmt.Registry) error { + + if m.SoftwareLicenses != nil { + if err := m.SoftwareLicenses.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("softwareLicenses") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("softwareLicenses") + } + return err + } + } + + return nil +} + +func (m *PVMInstanceReference) contextValidateSrcs(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Srcs); i++ { + + for ii := 0; ii < len(m.Srcs[i]); ii++ { + + if m.Srcs[i][ii] != nil { + if err := m.Srcs[i][ii].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("srcs" + "." + strconv.Itoa(i) + "." + strconv.Itoa(ii)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("srcs" + "." + strconv.Itoa(i) + "." + strconv.Itoa(ii)) + } + return err + } + } + + } + + } + + return nil +} + +func (m *PVMInstanceReference) contextValidateVirtualCores(ctx context.Context, formats strfmt.Registry) error { + + if m.VirtualCores != nil { + if err := m.VirtualCores.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("virtualCores") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("virtualCores") } return err } diff --git a/power/models/p_vm_instance_remove_network.go b/power/models/p_vm_instance_remove_network.go index 1d6dc39f..937e609d 100644 --- a/power/models/p_vm_instance_remove_network.go +++ b/power/models/p_vm_instance_remove_network.go @@ -6,12 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // PVMInstanceRemoveNetwork p VM instance remove network +// // swagger:model PVMInstanceRemoveNetwork type PVMInstanceRemoveNetwork struct { @@ -24,6 +26,11 @@ func (m *PVMInstanceRemoveNetwork) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this p VM instance remove network based on context it is used +func (m *PVMInstanceRemoveNetwork) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PVMInstanceRemoveNetwork) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/p_vm_instance_update.go b/power/models/p_vm_instance_update.go index 4a9cbfd6..89cb7788 100644 --- a/power/models/p_vm_instance_update.go +++ b/power/models/p_vm_instance_update.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PVMInstanceUpdate p VM instance update +// // swagger:model PVMInstanceUpdate type PVMInstanceUpdate struct { @@ -81,7 +82,6 @@ func (m *PVMInstanceUpdate) Validate(formats strfmt.Registry) error { } func (m *PVMInstanceUpdate) validatePinPolicy(formats strfmt.Registry) error { - if swag.IsZero(m.PinPolicy) { // not required return nil } @@ -89,6 +89,8 @@ func (m *PVMInstanceUpdate) validatePinPolicy(formats strfmt.Registry) error { if err := m.PinPolicy.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("pinPolicy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("pinPolicy") } return err } @@ -122,14 +124,13 @@ const ( // prop value enum func (m *PVMInstanceUpdate) validateProcTypeEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, pVmInstanceUpdateTypeProcTypePropEnum); err != nil { + if err := validate.EnumCase(path, location, value, pVmInstanceUpdateTypeProcTypePropEnum, true); err != nil { return err } return nil } func (m *PVMInstanceUpdate) validateProcType(formats strfmt.Registry) error { - if swag.IsZero(m.ProcType) { // not required return nil } @@ -143,7 +144,6 @@ func (m *PVMInstanceUpdate) validateProcType(formats strfmt.Registry) error { } func (m *PVMInstanceUpdate) validateSoftwareLicenses(formats strfmt.Registry) error { - if swag.IsZero(m.SoftwareLicenses) { // not required return nil } @@ -152,6 +152,8 @@ func (m *PVMInstanceUpdate) validateSoftwareLicenses(formats strfmt.Registry) er if err := m.SoftwareLicenses.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("softwareLicenses") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("softwareLicenses") } return err } @@ -161,7 +163,6 @@ func (m *PVMInstanceUpdate) validateSoftwareLicenses(formats strfmt.Registry) er } func (m *PVMInstanceUpdate) validateVirtualCores(formats strfmt.Registry) error { - if swag.IsZero(m.VirtualCores) { // not required return nil } @@ -170,6 +171,76 @@ func (m *PVMInstanceUpdate) validateVirtualCores(formats strfmt.Registry) error if err := m.VirtualCores.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("virtualCores") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("virtualCores") + } + return err + } + } + + return nil +} + +// ContextValidate validate this p VM instance update based on the context it is used +func (m *PVMInstanceUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePinPolicy(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSoftwareLicenses(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateVirtualCores(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PVMInstanceUpdate) contextValidatePinPolicy(ctx context.Context, formats strfmt.Registry) error { + + if err := m.PinPolicy.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pinPolicy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("pinPolicy") + } + return err + } + + return nil +} + +func (m *PVMInstanceUpdate) contextValidateSoftwareLicenses(ctx context.Context, formats strfmt.Registry) error { + + if m.SoftwareLicenses != nil { + if err := m.SoftwareLicenses.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("softwareLicenses") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("softwareLicenses") + } + return err + } + } + + return nil +} + +func (m *PVMInstanceUpdate) contextValidateVirtualCores(ctx context.Context, formats strfmt.Registry) error { + + if m.VirtualCores != nil { + if err := m.VirtualCores.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("virtualCores") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("virtualCores") } return err } diff --git a/power/models/p_vm_instance_update_response.go b/power/models/p_vm_instance_update_response.go index 029f7f1b..5f19935c 100644 --- a/power/models/p_vm_instance_update_response.go +++ b/power/models/p_vm_instance_update_response.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PVMInstanceUpdateResponse p VM instance update response +// // swagger:model PVMInstanceUpdateResponse type PVMInstanceUpdateResponse struct { @@ -61,7 +62,6 @@ func (m *PVMInstanceUpdateResponse) Validate(formats strfmt.Registry) error { } func (m *PVMInstanceUpdateResponse) validatePinPolicy(formats strfmt.Registry) error { - if swag.IsZero(m.PinPolicy) { // not required return nil } @@ -69,6 +69,8 @@ func (m *PVMInstanceUpdateResponse) validatePinPolicy(formats strfmt.Registry) e if err := m.PinPolicy.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("pinPolicy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("pinPolicy") } return err } @@ -102,14 +104,13 @@ const ( // prop value enum func (m *PVMInstanceUpdateResponse) validateProcTypeEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, pVmInstanceUpdateResponseTypeProcTypePropEnum); err != nil { + if err := validate.EnumCase(path, location, value, pVmInstanceUpdateResponseTypeProcTypePropEnum, true); err != nil { return err } return nil } func (m *PVMInstanceUpdateResponse) validateProcType(formats strfmt.Registry) error { - if swag.IsZero(m.ProcType) { // not required return nil } @@ -122,6 +123,34 @@ func (m *PVMInstanceUpdateResponse) validateProcType(formats strfmt.Registry) er return nil } +// ContextValidate validate this p VM instance update response based on the context it is used +func (m *PVMInstanceUpdateResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePinPolicy(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PVMInstanceUpdateResponse) contextValidatePinPolicy(ctx context.Context, formats strfmt.Registry) error { + + if err := m.PinPolicy.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pinPolicy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("pinPolicy") + } + return err + } + + return nil +} + // MarshalBinary interface implementation func (m *PVMInstanceUpdateResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/p_vm_instance_volume_update.go b/power/models/p_vm_instance_volume_update.go index e21263c5..d3ab5a7c 100644 --- a/power/models/p_vm_instance_volume_update.go +++ b/power/models/p_vm_instance_volume_update.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PVMInstanceVolumeUpdate p VM instance volume update +// // swagger:model PVMInstanceVolumeUpdate type PVMInstanceVolumeUpdate struct { @@ -45,6 +47,11 @@ func (m *PVMInstanceVolumeUpdate) validateDeleteOnTermination(formats strfmt.Reg return nil } +// ContextValidate validates this p VM instance volume update based on context it is used +func (m *PVMInstanceVolumeUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PVMInstanceVolumeUpdate) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/p_vm_instances.go b/power/models/p_vm_instances.go index 88eed70b..c535bc5f 100644 --- a/power/models/p_vm_instances.go +++ b/power/models/p_vm_instances.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PVMInstances p VM instances +// // swagger:model PVMInstances type PVMInstances struct { @@ -53,6 +54,42 @@ func (m *PVMInstances) validatePvmInstances(formats strfmt.Registry) error { if err := m.PvmInstances[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("pvmInstances" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("pvmInstances" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this p VM instances based on the context it is used +func (m *PVMInstances) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePvmInstances(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PVMInstances) contextValidatePvmInstances(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.PvmInstances); i++ { + + if m.PvmInstances[i] != nil { + if err := m.PvmInstances[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pvmInstances" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("pvmInstances" + "." + strconv.Itoa(i)) } return err } diff --git a/power/models/peer_gateway_address.go b/power/models/peer_gateway_address.go index 323a8dc5..1a060a63 100644 --- a/power/models/peer_gateway_address.go +++ b/power/models/peer_gateway_address.go @@ -6,13 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/validate" ) // PeerGatewayAddress IP address of the Peer Gateway attached to this VPNConnection +// Example: 192.168.1.1 +// // swagger:model PeerGatewayAddress type PeerGatewayAddress strfmt.IPv4 @@ -29,3 +32,8 @@ func (m PeerGatewayAddress) Validate(formats strfmt.Registry) error { } return nil } + +// ContextValidate validates this peer gateway address based on context it is used +func (m PeerGatewayAddress) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/power/models/peer_subnet_update.go b/power/models/peer_subnet_update.go index 84c6dfe8..863dd974 100644 --- a/power/models/peer_subnet_update.go +++ b/power/models/peer_subnet_update.go @@ -6,18 +6,21 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PeerSubnetUpdate CIDR of peer subnet to attach/detach +// // swagger:model PeerSubnetUpdate type PeerSubnetUpdate struct { // cidr + // Example: 128.170.1.0/32 // Required: true Cidr *string `json:"cidr"` } @@ -45,6 +48,11 @@ func (m *PeerSubnetUpdate) validateCidr(formats strfmt.Registry) error { return nil } +// ContextValidate validates this peer subnet update based on context it is used +func (m *PeerSubnetUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PeerSubnetUpdate) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/peer_subnets.go b/power/models/peer_subnets.go index f2f2cafd..42c108d6 100644 --- a/power/models/peer_subnets.go +++ b/power/models/peer_subnets.go @@ -6,16 +6,19 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // PeerSubnets peer subnets +// // swagger:model PeerSubnets type PeerSubnets struct { // an array of strings containing CIDR of peer subnets + // Example: ["128.170.1.0/20","128.169.1.0/24","128.168.1.0/27","128.170.1.0/32"] PeerSubnets []string `json:"peerSubnets"` } @@ -24,6 +27,11 @@ func (m *PeerSubnets) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this peer subnets based on context it is used +func (m *PeerSubnets) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PeerSubnets) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/peering_network.go b/power/models/peering_network.go index 4b77e777..9530fe17 100644 --- a/power/models/peering_network.go +++ b/power/models/peering_network.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PeeringNetwork peering network +// // swagger:model PeeringNetwork type PeeringNetwork struct { @@ -65,6 +67,11 @@ func (m *PeeringNetwork) validateProjectName(formats strfmt.Registry) error { return nil } +// ContextValidate validates this peering network based on context it is used +func (m *PeeringNetwork) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PeeringNetwork) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/pin_policy.go b/power/models/pin_policy.go index b3493ba5..1536e5e4 100644 --- a/power/models/pin_policy.go +++ b/power/models/pin_policy.go @@ -6,18 +6,24 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/validate" ) // PinPolicy Specify PVM pin policy +// // swagger:model PinPolicy type PinPolicy string +func NewPinPolicy(value PinPolicy) *PinPolicy { + v := value + return &v +} + const ( // PinPolicyNone captures enum value "none" @@ -44,7 +50,7 @@ func init() { } func (m PinPolicy) validatePinPolicyEnum(path, location string, value PinPolicy) error { - if err := validate.Enum(path, location, value, pinPolicyEnum); err != nil { + if err := validate.EnumCase(path, location, value, pinPolicyEnum, true); err != nil { return err } return nil @@ -64,3 +70,8 @@ func (m PinPolicy) Validate(formats strfmt.Registry) error { } return nil } + +// ContextValidate validates this pin policy based on context it is used +func (m PinPolicy) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/power/models/placement_group.go b/power/models/placement_group.go index dcd75772..31661603 100644 --- a/power/models/placement_group.go +++ b/power/models/placement_group.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PlacementGroup placement group +// // swagger:model PlacementGroup type PlacementGroup struct { @@ -107,13 +108,13 @@ const ( // PlacementGroupPolicyAffinity captures enum value "affinity" PlacementGroupPolicyAffinity string = "affinity" - // PlacementGroupPolicyAntiAffinity captures enum value "anti-affinity" - PlacementGroupPolicyAntiAffinity string = "anti-affinity" + // PlacementGroupPolicyAntiDashAffinity captures enum value "anti-affinity" + PlacementGroupPolicyAntiDashAffinity string = "anti-affinity" ) // prop value enum func (m *PlacementGroup) validatePolicyEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, placementGroupTypePolicyPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, placementGroupTypePolicyPropEnum, true); err != nil { return err } return nil @@ -133,6 +134,11 @@ func (m *PlacementGroup) validatePolicy(formats strfmt.Registry) error { return nil } +// ContextValidate validates this placement group based on context it is used +func (m *PlacementGroup) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PlacementGroup) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/placement_group_create.go b/power/models/placement_group_create.go index 64004b10..2fd3d083 100644 --- a/power/models/placement_group_create.go +++ b/power/models/placement_group_create.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PlacementGroupCreate placement group create +// // swagger:model PlacementGroupCreate type PlacementGroupCreate struct { @@ -73,13 +74,13 @@ const ( // PlacementGroupCreatePolicyAffinity captures enum value "affinity" PlacementGroupCreatePolicyAffinity string = "affinity" - // PlacementGroupCreatePolicyAntiAffinity captures enum value "anti-affinity" - PlacementGroupCreatePolicyAntiAffinity string = "anti-affinity" + // PlacementGroupCreatePolicyAntiDashAffinity captures enum value "anti-affinity" + PlacementGroupCreatePolicyAntiDashAffinity string = "anti-affinity" ) // prop value enum func (m *PlacementGroupCreate) validatePolicyEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, placementGroupCreateTypePolicyPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, placementGroupCreateTypePolicyPropEnum, true); err != nil { return err } return nil @@ -99,6 +100,11 @@ func (m *PlacementGroupCreate) validatePolicy(formats strfmt.Registry) error { return nil } +// ContextValidate validates this placement group create based on context it is used +func (m *PlacementGroupCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PlacementGroupCreate) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/placement_group_server.go b/power/models/placement_group_server.go index f1346950..73d29188 100644 --- a/power/models/placement_group_server.go +++ b/power/models/placement_group_server.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PlacementGroupServer placement group server +// // swagger:model PlacementGroupServer type PlacementGroupServer struct { @@ -45,6 +47,11 @@ func (m *PlacementGroupServer) validateID(formats strfmt.Registry) error { return nil } +// ContextValidate validates this placement group server based on context it is used +func (m *PlacementGroupServer) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PlacementGroupServer) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/placement_groups.go b/power/models/placement_groups.go index 0e6ec690..9c033b69 100644 --- a/power/models/placement_groups.go +++ b/power/models/placement_groups.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PlacementGroups placement groups +// // swagger:model PlacementGroups type PlacementGroups struct { @@ -53,6 +54,42 @@ func (m *PlacementGroups) validatePlacementGroups(formats strfmt.Registry) error if err := m.PlacementGroups[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("placementGroups" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("placementGroups" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this placement groups based on the context it is used +func (m *PlacementGroups) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePlacementGroups(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PlacementGroups) contextValidatePlacementGroups(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.PlacementGroups); i++ { + + if m.PlacementGroups[i] != nil { + if err := m.PlacementGroups[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("placementGroups" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("placementGroups" + "." + strconv.Itoa(i)) } return err } diff --git a/power/models/plan.go b/power/models/plan.go index 7b38a507..8a3eb9c4 100644 --- a/power/models/plan.go +++ b/power/models/plan.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Plan plan +// // swagger:model Plan type Plan struct { @@ -96,7 +98,6 @@ func (m *Plan) validateName(formats strfmt.Registry) error { } func (m *Plan) validateSchemas(formats strfmt.Registry) error { - if swag.IsZero(m.Schemas) { // not required return nil } @@ -105,6 +106,38 @@ func (m *Plan) validateSchemas(formats strfmt.Registry) error { if err := m.Schemas.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("schemas") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("schemas") + } + return err + } + } + + return nil +} + +// ContextValidate validate this plan based on the context it is used +func (m *Plan) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateSchemas(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Plan) contextValidateSchemas(ctx context.Context, formats strfmt.Registry) error { + + if m.Schemas != nil { + if err := m.Schemas.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("schemas") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("schemas") } return err } diff --git a/power/models/policy_versions.go b/power/models/policy_versions.go index 12821b68..fa426855 100644 --- a/power/models/policy_versions.go +++ b/power/models/policy_versions.go @@ -6,10 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + + "github.com/go-openapi/strfmt" ) // PolicyVersions policy versions +// Example: [1,2] +// // swagger:model PolicyVersions type PolicyVersions []float64 @@ -17,3 +21,8 @@ type PolicyVersions []float64 func (m PolicyVersions) Validate(formats strfmt.Registry) error { return nil } + +// ContextValidate validates this policy versions based on context it is used +func (m PolicyVersions) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/power/models/region_storage_types.go b/power/models/region_storage_types.go index b5a50ef4..768bc4b5 100644 --- a/power/models/region_storage_types.go +++ b/power/models/region_storage_types.go @@ -6,15 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // RegionStorageTypes An array of of storage types supported in a region +// // swagger:model RegionStorageTypes type RegionStorageTypes []*StorageType @@ -31,6 +32,33 @@ func (m RegionStorageTypes) Validate(formats strfmt.Registry) error { if err := m[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName(strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validate this region storage types based on the context it is used +func (m RegionStorageTypes) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + + if m[i] != nil { + if err := m[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(strconv.Itoa(i)) } return err } diff --git a/power/models/s_a_p_create.go b/power/models/s_a_p_create.go index bcae1dbd..68ab752a 100644 --- a/power/models/s_a_p_create.go +++ b/power/models/s_a_p_create.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // SAPCreate s a p create +// // swagger:model SAPCreate type SAPCreate struct { @@ -57,7 +58,7 @@ type SAPCreate struct { UserData string `json:"userData,omitempty"` // List of Volume IDs to attach to the pvm-instance on creation - VolumeIds []string `json:"volumeIDs"` + VolumeIDs []string `json:"volumeIDs"` } // Validate validates this s a p create @@ -108,7 +109,6 @@ func (m *SAPCreate) validateImageID(formats strfmt.Registry) error { } func (m *SAPCreate) validateInstances(formats strfmt.Registry) error { - if swag.IsZero(m.Instances) { // not required return nil } @@ -117,6 +117,8 @@ func (m *SAPCreate) validateInstances(formats strfmt.Registry) error { if err := m.Instances.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("instances") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("instances") } return err } @@ -149,6 +151,8 @@ func (m *SAPCreate) validateNetworks(formats strfmt.Registry) error { if err := m.Networks[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("networks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networks" + "." + strconv.Itoa(i)) } return err } @@ -160,7 +164,6 @@ func (m *SAPCreate) validateNetworks(formats strfmt.Registry) error { } func (m *SAPCreate) validatePinPolicy(formats strfmt.Registry) error { - if swag.IsZero(m.PinPolicy) { // not required return nil } @@ -168,6 +171,8 @@ func (m *SAPCreate) validatePinPolicy(formats strfmt.Registry) error { if err := m.PinPolicy.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("pinPolicy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("pinPolicy") } return err } @@ -185,7 +190,6 @@ func (m *SAPCreate) validateProfileID(formats strfmt.Registry) error { } func (m *SAPCreate) validateStorageAffinity(formats strfmt.Registry) error { - if swag.IsZero(m.StorageAffinity) { // not required return nil } @@ -194,6 +198,100 @@ func (m *SAPCreate) validateStorageAffinity(formats strfmt.Registry) error { if err := m.StorageAffinity.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("storageAffinity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("storageAffinity") + } + return err + } + } + + return nil +} + +// ContextValidate validate this s a p create based on the context it is used +func (m *SAPCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateInstances(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateNetworks(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePinPolicy(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStorageAffinity(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SAPCreate) contextValidateInstances(ctx context.Context, formats strfmt.Registry) error { + + if m.Instances != nil { + if err := m.Instances.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("instances") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("instances") + } + return err + } + } + + return nil +} + +func (m *SAPCreate) contextValidateNetworks(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Networks); i++ { + + if m.Networks[i] != nil { + if err := m.Networks[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *SAPCreate) contextValidatePinPolicy(ctx context.Context, formats strfmt.Registry) error { + + if err := m.PinPolicy.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pinPolicy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("pinPolicy") + } + return err + } + + return nil +} + +func (m *SAPCreate) contextValidateStorageAffinity(ctx context.Context, formats strfmt.Registry) error { + + if m.StorageAffinity != nil { + if err := m.StorageAffinity.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("storageAffinity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("storageAffinity") } return err } diff --git a/power/models/s_a_p_profile.go b/power/models/s_a_p_profile.go index e05cd737..73096fa6 100644 --- a/power/models/s_a_p_profile.go +++ b/power/models/s_a_p_profile.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // SAPProfile s a p profile +// // swagger:model SAPProfile type SAPProfile struct { @@ -130,16 +131,16 @@ const ( // SAPProfileTypeMemory captures enum value "memory" SAPProfileTypeMemory string = "memory" - // SAPProfileTypeNonProduction captures enum value "non-production" - SAPProfileTypeNonProduction string = "non-production" + // SAPProfileTypeNonDashProduction captures enum value "non-production" + SAPProfileTypeNonDashProduction string = "non-production" - // SAPProfileTypeUltraMemory captures enum value "ultra-memory" - SAPProfileTypeUltraMemory string = "ultra-memory" + // SAPProfileTypeUltraDashMemory captures enum value "ultra-memory" + SAPProfileTypeUltraDashMemory string = "ultra-memory" ) // prop value enum func (m *SAPProfile) validateTypeEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, sAPProfileTypeTypePropEnum); err != nil { + if err := validate.EnumCase(path, location, value, sAPProfileTypeTypePropEnum, true); err != nil { return err } return nil @@ -159,6 +160,11 @@ func (m *SAPProfile) validateType(formats strfmt.Registry) error { return nil } +// ContextValidate validates this s a p profile based on context it is used +func (m *SAPProfile) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *SAPProfile) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/s_a_p_profile_reference.go b/power/models/s_a_p_profile_reference.go index e12750c3..9f7cd91f 100644 --- a/power/models/s_a_p_profile_reference.go +++ b/power/models/s_a_p_profile_reference.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // SAPProfileReference s a p profile reference +// // swagger:model SAPProfileReference type SAPProfileReference struct { @@ -62,6 +64,11 @@ func (m *SAPProfileReference) validateProfileID(formats strfmt.Registry) error { return nil } +// ContextValidate validates this s a p profile reference based on context it is used +func (m *SAPProfileReference) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *SAPProfileReference) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/s_a_p_profiles.go b/power/models/s_a_p_profiles.go index 3fd70e46..02c67b96 100644 --- a/power/models/s_a_p_profiles.go +++ b/power/models/s_a_p_profiles.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // SAPProfiles s a p profiles +// // swagger:model SAPProfiles type SAPProfiles struct { @@ -53,6 +54,42 @@ func (m *SAPProfiles) validateProfiles(formats strfmt.Registry) error { if err := m.Profiles[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("profiles" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("profiles" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this s a p profiles based on the context it is used +func (m *SAPProfiles) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateProfiles(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SAPProfiles) contextValidateProfiles(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Profiles); i++ { + + if m.Profiles[i] != nil { + if err := m.Profiles[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("profiles" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("profiles" + "." + strconv.Itoa(i)) } return err } diff --git a/power/models/s_r_c.go b/power/models/s_r_c.go index 3f54a518..e9d191fa 100644 --- a/power/models/s_r_c.go +++ b/power/models/s_r_c.go @@ -6,12 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // SRC s r c +// // swagger:model SRC type SRC struct { @@ -27,6 +29,11 @@ func (m *SRC) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this s r c based on context it is used +func (m *SRC) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *SRC) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/schema_parameters.go b/power/models/schema_parameters.go index e464790b..118c6b0f 100644 --- a/power/models/schema_parameters.go +++ b/power/models/schema_parameters.go @@ -6,12 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // SchemaParameters schema parameters +// // swagger:model SchemaParameters type SchemaParameters struct { @@ -24,6 +26,11 @@ func (m *SchemaParameters) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this schema parameters based on context it is used +func (m *SchemaParameters) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *SchemaParameters) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/schemas_object.go b/power/models/schemas_object.go index 0900d82b..1f7ce4ef 100644 --- a/power/models/schemas_object.go +++ b/power/models/schemas_object.go @@ -6,13 +6,15 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // SchemasObject schemas object +// // swagger:model SchemasObject type SchemasObject struct { @@ -42,7 +44,6 @@ func (m *SchemasObject) Validate(formats strfmt.Registry) error { } func (m *SchemasObject) validateServiceBinding(formats strfmt.Registry) error { - if swag.IsZero(m.ServiceBinding) { // not required return nil } @@ -51,6 +52,8 @@ func (m *SchemasObject) validateServiceBinding(formats strfmt.Registry) error { if err := m.ServiceBinding.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("service_binding") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("service_binding") } return err } @@ -60,7 +63,6 @@ func (m *SchemasObject) validateServiceBinding(formats strfmt.Registry) error { } func (m *SchemasObject) validateServiceInstance(formats strfmt.Registry) error { - if swag.IsZero(m.ServiceInstance) { // not required return nil } @@ -69,6 +71,58 @@ func (m *SchemasObject) validateServiceInstance(formats strfmt.Registry) error { if err := m.ServiceInstance.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("service_instance") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("service_instance") + } + return err + } + } + + return nil +} + +// ContextValidate validate this schemas object based on the context it is used +func (m *SchemasObject) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateServiceBinding(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateServiceInstance(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SchemasObject) contextValidateServiceBinding(ctx context.Context, formats strfmt.Registry) error { + + if m.ServiceBinding != nil { + if err := m.ServiceBinding.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("service_binding") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("service_binding") + } + return err + } + } + + return nil +} + +func (m *SchemasObject) contextValidateServiceInstance(ctx context.Context, formats strfmt.Registry) error { + + if m.ServiceInstance != nil { + if err := m.ServiceInstance.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("service_instance") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("service_instance") } return err } diff --git a/power/models/service.go b/power/models/service.go index 51d719f6..8df437e3 100644 --- a/power/models/service.go +++ b/power/models/service.go @@ -6,17 +6,18 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Service service +// // swagger:model Service type Service struct { @@ -116,7 +117,6 @@ func (m *Service) validateBindable(formats strfmt.Registry) error { } func (m *Service) validateDashboardClient(formats strfmt.Registry) error { - if swag.IsZero(m.DashboardClient) { // not required return nil } @@ -125,6 +125,8 @@ func (m *Service) validateDashboardClient(formats strfmt.Registry) error { if err := m.DashboardClient.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("dashboard_client") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("dashboard_client") } return err } @@ -175,6 +177,8 @@ func (m *Service) validatePlans(formats strfmt.Registry) error { if err := m.Plans[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("plans" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("plans" + "." + strconv.Itoa(i)) } return err } @@ -198,14 +202,13 @@ func init() { } func (m *Service) validateRequiresItemsEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, serviceRequiresItemsEnum); err != nil { + if err := validate.EnumCase(path, location, value, serviceRequiresItemsEnum, true); err != nil { return err } return nil } func (m *Service) validateRequires(formats strfmt.Registry) error { - if swag.IsZero(m.Requires) { // not required return nil } @@ -222,6 +225,60 @@ func (m *Service) validateRequires(formats strfmt.Registry) error { return nil } +// ContextValidate validate this service based on the context it is used +func (m *Service) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDashboardClient(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePlans(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Service) contextValidateDashboardClient(ctx context.Context, formats strfmt.Registry) error { + + if m.DashboardClient != nil { + if err := m.DashboardClient.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("dashboard_client") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("dashboard_client") + } + return err + } + } + + return nil +} + +func (m *Service) contextValidatePlans(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Plans); i++ { + + if m.Plans[i] != nil { + if err := m.Plans[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("plans" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("plans" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *Service) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/service_binding.go b/power/models/service_binding.go index 994409d3..a20665cc 100644 --- a/power/models/service_binding.go +++ b/power/models/service_binding.go @@ -6,15 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ServiceBinding service binding +// // swagger:model ServiceBinding type ServiceBinding struct { @@ -46,7 +47,6 @@ func (m *ServiceBinding) Validate(formats strfmt.Registry) error { } func (m *ServiceBinding) validateVolumeMounts(formats strfmt.Registry) error { - if swag.IsZero(m.VolumeMounts) { // not required return nil } @@ -60,6 +60,42 @@ func (m *ServiceBinding) validateVolumeMounts(formats strfmt.Registry) error { if err := m.VolumeMounts[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("volume_mounts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("volume_mounts" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this service binding based on the context it is used +func (m *ServiceBinding) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateVolumeMounts(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceBinding) contextValidateVolumeMounts(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.VolumeMounts); i++ { + + if m.VolumeMounts[i] != nil { + if err := m.VolumeMounts[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("volume_mounts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("volume_mounts" + "." + strconv.Itoa(i)) } return err } diff --git a/power/models/service_binding_request.go b/power/models/service_binding_request.go index 68ca42fc..dbadb948 100644 --- a/power/models/service_binding_request.go +++ b/power/models/service_binding_request.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // ServiceBindingRequest service binding request +// // swagger:model ServiceBindingRequest type ServiceBindingRequest struct { @@ -61,7 +63,6 @@ func (m *ServiceBindingRequest) Validate(formats strfmt.Registry) error { } func (m *ServiceBindingRequest) validateBindResource(formats strfmt.Registry) error { - if swag.IsZero(m.BindResource) { // not required return nil } @@ -70,6 +71,8 @@ func (m *ServiceBindingRequest) validateBindResource(formats strfmt.Registry) er if err := m.BindResource.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("bind_resource") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("bind_resource") } return err } @@ -96,6 +99,36 @@ func (m *ServiceBindingRequest) validateServiceID(formats strfmt.Registry) error return nil } +// ContextValidate validate this service binding request based on the context it is used +func (m *ServiceBindingRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBindResource(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceBindingRequest) contextValidateBindResource(ctx context.Context, formats strfmt.Registry) error { + + if m.BindResource != nil { + if err := m.BindResource.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("bind_resource") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("bind_resource") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ServiceBindingRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/service_binding_resource.go b/power/models/service_binding_resource.go index 1a97439d..4fcb7ce7 100644 --- a/power/models/service_binding_resource.go +++ b/power/models/service_binding_resource.go @@ -6,15 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ServiceBindingResource service binding resource +// // swagger:model ServiceBindingResource type ServiceBindingResource struct { @@ -49,7 +50,6 @@ func (m *ServiceBindingResource) Validate(formats strfmt.Registry) error { } func (m *ServiceBindingResource) validateVolumeMounts(formats strfmt.Registry) error { - if swag.IsZero(m.VolumeMounts) { // not required return nil } @@ -63,6 +63,42 @@ func (m *ServiceBindingResource) validateVolumeMounts(formats strfmt.Registry) e if err := m.VolumeMounts[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("volume_mounts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("volume_mounts" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this service binding resource based on the context it is used +func (m *ServiceBindingResource) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateVolumeMounts(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceBindingResource) contextValidateVolumeMounts(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.VolumeMounts); i++ { + + if m.VolumeMounts[i] != nil { + if err := m.VolumeMounts[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("volume_mounts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("volume_mounts" + "." + strconv.Itoa(i)) } return err } diff --git a/power/models/service_binding_resource_object.go b/power/models/service_binding_resource_object.go index cc1aa4dd..dc89fff6 100644 --- a/power/models/service_binding_resource_object.go +++ b/power/models/service_binding_resource_object.go @@ -6,12 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ServiceBindingResourceObject service binding resource object +// // swagger:model ServiceBindingResourceObject type ServiceBindingResourceObject struct { @@ -27,6 +29,11 @@ func (m *ServiceBindingResourceObject) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this service binding resource object based on context it is used +func (m *ServiceBindingResourceObject) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ServiceBindingResourceObject) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/service_binding_schema_object.go b/power/models/service_binding_schema_object.go index 9df0a3da..bb3ba6ac 100644 --- a/power/models/service_binding_schema_object.go +++ b/power/models/service_binding_schema_object.go @@ -6,13 +6,15 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ServiceBindingSchemaObject service binding schema object +// // swagger:model ServiceBindingSchemaObject type ServiceBindingSchemaObject struct { @@ -35,7 +37,6 @@ func (m *ServiceBindingSchemaObject) Validate(formats strfmt.Registry) error { } func (m *ServiceBindingSchemaObject) validateCreate(formats strfmt.Registry) error { - if swag.IsZero(m.Create) { // not required return nil } @@ -44,6 +45,38 @@ func (m *ServiceBindingSchemaObject) validateCreate(formats strfmt.Registry) err if err := m.Create.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("create") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("create") + } + return err + } + } + + return nil +} + +// ContextValidate validate this service binding schema object based on the context it is used +func (m *ServiceBindingSchemaObject) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCreate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceBindingSchemaObject) contextValidateCreate(ctx context.Context, formats strfmt.Registry) error { + + if m.Create != nil { + if err := m.Create.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("create") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("create") } return err } diff --git a/power/models/service_binding_volume_mount.go b/power/models/service_binding_volume_mount.go index c3c23e23..c077d6c0 100644 --- a/power/models/service_binding_volume_mount.go +++ b/power/models/service_binding_volume_mount.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // ServiceBindingVolumeMount service binding volume mount +// // swagger:model ServiceBindingVolumeMount type ServiceBindingVolumeMount struct { @@ -91,6 +92,8 @@ func (m *ServiceBindingVolumeMount) validateDevice(formats strfmt.Registry) erro if err := m.Device.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("device") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("device") } return err } @@ -119,7 +122,7 @@ const ( // prop value enum func (m *ServiceBindingVolumeMount) validateDeviceTypeEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, serviceBindingVolumeMountTypeDeviceTypePropEnum); err != nil { + if err := validate.EnumCase(path, location, value, serviceBindingVolumeMountTypeDeviceTypePropEnum, true); err != nil { return err } return nil @@ -171,7 +174,7 @@ const ( // prop value enum func (m *ServiceBindingVolumeMount) validateModeEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, serviceBindingVolumeMountTypeModePropEnum); err != nil { + if err := validate.EnumCase(path, location, value, serviceBindingVolumeMountTypeModePropEnum, true); err != nil { return err } return nil @@ -191,6 +194,36 @@ func (m *ServiceBindingVolumeMount) validateMode(formats strfmt.Registry) error return nil } +// ContextValidate validate this service binding volume mount based on the context it is used +func (m *ServiceBindingVolumeMount) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDevice(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceBindingVolumeMount) contextValidateDevice(ctx context.Context, formats strfmt.Registry) error { + + if m.Device != nil { + if err := m.Device.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("device") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("device") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ServiceBindingVolumeMount) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/service_binding_volume_mount_device.go b/power/models/service_binding_volume_mount_device.go index 0a64a3a7..f95ff3f7 100644 --- a/power/models/service_binding_volume_mount_device.go +++ b/power/models/service_binding_volume_mount_device.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // ServiceBindingVolumeMountDevice service binding volume mount device +// // swagger:model ServiceBindingVolumeMountDevice type ServiceBindingVolumeMountDevice struct { @@ -48,6 +50,11 @@ func (m *ServiceBindingVolumeMountDevice) validateVolumeID(formats strfmt.Regist return nil } +// ContextValidate validates this service binding volume mount device based on context it is used +func (m *ServiceBindingVolumeMountDevice) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ServiceBindingVolumeMountDevice) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/service_instance.go b/power/models/service_instance.go index 98d6f004..2c6ca23c 100644 --- a/power/models/service_instance.go +++ b/power/models/service_instance.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // ServiceInstance service instance +// // swagger:model ServiceInstance type ServiceInstance struct { @@ -79,6 +81,11 @@ func (m *ServiceInstance) validateLastActive(formats strfmt.Registry) error { return nil } +// ContextValidate validates this service instance based on context it is used +func (m *ServiceInstance) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ServiceInstance) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/service_instance_async_operation.go b/power/models/service_instance_async_operation.go index 49c62ee3..2711e667 100644 --- a/power/models/service_instance_async_operation.go +++ b/power/models/service_instance_async_operation.go @@ -6,12 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ServiceInstanceAsyncOperation service instance async operation +// // swagger:model ServiceInstanceAsyncOperation type ServiceInstanceAsyncOperation struct { @@ -27,6 +29,11 @@ func (m *ServiceInstanceAsyncOperation) Validate(formats strfmt.Registry) error return nil } +// ContextValidate validates this service instance async operation based on context it is used +func (m *ServiceInstanceAsyncOperation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ServiceInstanceAsyncOperation) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/service_instance_previous_values.go b/power/models/service_instance_previous_values.go index df228924..33c2f1c9 100644 --- a/power/models/service_instance_previous_values.go +++ b/power/models/service_instance_previous_values.go @@ -6,12 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ServiceInstancePreviousValues service instance previous values +// // swagger:model ServiceInstancePreviousValues type ServiceInstancePreviousValues struct { @@ -33,6 +35,11 @@ func (m *ServiceInstancePreviousValues) Validate(formats strfmt.Registry) error return nil } +// ContextValidate validates this service instance previous values based on context it is used +func (m *ServiceInstancePreviousValues) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ServiceInstancePreviousValues) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/service_instance_provision.go b/power/models/service_instance_provision.go index dd9973eb..7fb520f2 100644 --- a/power/models/service_instance_provision.go +++ b/power/models/service_instance_provision.go @@ -6,12 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ServiceInstanceProvision service instance provision +// // swagger:model ServiceInstanceProvision type ServiceInstanceProvision struct { @@ -24,6 +26,11 @@ func (m *ServiceInstanceProvision) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this service instance provision based on context it is used +func (m *ServiceInstanceProvision) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ServiceInstanceProvision) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/service_instance_provision_request.go b/power/models/service_instance_provision_request.go index 52835c28..6e84dd46 100644 --- a/power/models/service_instance_provision_request.go +++ b/power/models/service_instance_provision_request.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // ServiceInstanceProvisionRequest service instance provision request +// // swagger:model ServiceInstanceProvisionRequest type ServiceInstanceProvisionRequest struct { @@ -74,6 +76,11 @@ func (m *ServiceInstanceProvisionRequest) validateServiceID(formats strfmt.Regis return nil } +// ContextValidate validates this service instance provision request based on context it is used +func (m *ServiceInstanceProvisionRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ServiceInstanceProvisionRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/service_instance_request.go b/power/models/service_instance_request.go index fd635a61..67afe7a1 100644 --- a/power/models/service_instance_request.go +++ b/power/models/service_instance_request.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // ServiceInstanceRequest service instance request +// // swagger:model ServiceInstanceRequest type ServiceInstanceRequest struct { @@ -51,6 +53,11 @@ func (m *ServiceInstanceRequest) validateEnabled(formats strfmt.Registry) error return nil } +// ContextValidate validates this service instance request based on context it is used +func (m *ServiceInstanceRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ServiceInstanceRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/service_instance_resource.go b/power/models/service_instance_resource.go index 95989abe..1a7b2da7 100644 --- a/power/models/service_instance_resource.go +++ b/power/models/service_instance_resource.go @@ -6,12 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ServiceInstanceResource service instance resource +// // swagger:model ServiceInstanceResource type ServiceInstanceResource struct { @@ -33,6 +35,11 @@ func (m *ServiceInstanceResource) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this service instance resource based on context it is used +func (m *ServiceInstanceResource) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ServiceInstanceResource) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/service_instance_schema_object.go b/power/models/service_instance_schema_object.go index 0c1e0e16..fb085f5f 100644 --- a/power/models/service_instance_schema_object.go +++ b/power/models/service_instance_schema_object.go @@ -6,13 +6,15 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // ServiceInstanceSchemaObject service instance schema object +// // swagger:model ServiceInstanceSchemaObject type ServiceInstanceSchemaObject struct { @@ -42,7 +44,6 @@ func (m *ServiceInstanceSchemaObject) Validate(formats strfmt.Registry) error { } func (m *ServiceInstanceSchemaObject) validateCreate(formats strfmt.Registry) error { - if swag.IsZero(m.Create) { // not required return nil } @@ -51,6 +52,8 @@ func (m *ServiceInstanceSchemaObject) validateCreate(formats strfmt.Registry) er if err := m.Create.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("create") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("create") } return err } @@ -60,7 +63,6 @@ func (m *ServiceInstanceSchemaObject) validateCreate(formats strfmt.Registry) er } func (m *ServiceInstanceSchemaObject) validateUpdate(formats strfmt.Registry) error { - if swag.IsZero(m.Update) { // not required return nil } @@ -69,6 +71,58 @@ func (m *ServiceInstanceSchemaObject) validateUpdate(formats strfmt.Registry) er if err := m.Update.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("update") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("update") + } + return err + } + } + + return nil +} + +// ContextValidate validate this service instance schema object based on the context it is used +func (m *ServiceInstanceSchemaObject) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCreate(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUpdate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceInstanceSchemaObject) contextValidateCreate(ctx context.Context, formats strfmt.Registry) error { + + if m.Create != nil { + if err := m.Create.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("create") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("create") + } + return err + } + } + + return nil +} + +func (m *ServiceInstanceSchemaObject) contextValidateUpdate(ctx context.Context, formats strfmt.Registry) error { + + if m.Update != nil { + if err := m.Update.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("update") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("update") } return err } diff --git a/power/models/service_instance_update_request.go b/power/models/service_instance_update_request.go index a1894b8d..b4a40795 100644 --- a/power/models/service_instance_update_request.go +++ b/power/models/service_instance_update_request.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // ServiceInstanceUpdateRequest service instance update request +// // swagger:model ServiceInstanceUpdateRequest type ServiceInstanceUpdateRequest struct { @@ -53,7 +55,6 @@ func (m *ServiceInstanceUpdateRequest) Validate(formats strfmt.Registry) error { } func (m *ServiceInstanceUpdateRequest) validatePreviousValues(formats strfmt.Registry) error { - if swag.IsZero(m.PreviousValues) { // not required return nil } @@ -62,6 +63,8 @@ func (m *ServiceInstanceUpdateRequest) validatePreviousValues(formats strfmt.Reg if err := m.PreviousValues.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("previous_values") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("previous_values") } return err } @@ -79,6 +82,36 @@ func (m *ServiceInstanceUpdateRequest) validateServiceID(formats strfmt.Registry return nil } +// ContextValidate validate this service instance update request based on the context it is used +func (m *ServiceInstanceUpdateRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePreviousValues(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceInstanceUpdateRequest) contextValidatePreviousValues(ctx context.Context, formats strfmt.Registry) error { + + if m.PreviousValues != nil { + if err := m.PreviousValues.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("previous_values") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("previous_values") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ServiceInstanceUpdateRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/snapshot.go b/power/models/snapshot.go index ab301f42..c5d2fc31 100644 --- a/power/models/snapshot.go +++ b/power/models/snapshot.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Snapshot snapshot +// // swagger:model Snapshot type Snapshot struct { @@ -89,7 +91,6 @@ func (m *Snapshot) Validate(formats strfmt.Registry) error { } func (m *Snapshot) validateCreationDate(formats strfmt.Registry) error { - if swag.IsZero(m.CreationDate) { // not required return nil } @@ -102,7 +103,6 @@ func (m *Snapshot) validateCreationDate(formats strfmt.Registry) error { } func (m *Snapshot) validateLastUpdateDate(formats strfmt.Registry) error { - if swag.IsZero(m.LastUpdateDate) { // not required return nil } @@ -143,6 +143,15 @@ func (m *Snapshot) validateSnapshotID(formats strfmt.Registry) error { func (m *Snapshot) validateVolumeSnapshots(formats strfmt.Registry) error { + if err := validate.Required("volumeSnapshots", "body", m.VolumeSnapshots); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this snapshot based on context it is used +func (m *Snapshot) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } diff --git a/power/models/snapshot_create.go b/power/models/snapshot_create.go index 17827deb..00377110 100644 --- a/power/models/snapshot_create.go +++ b/power/models/snapshot_create.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // SnapshotCreate snapshot create +// // swagger:model SnapshotCreate type SnapshotCreate struct { @@ -25,7 +27,7 @@ type SnapshotCreate struct { Name *string `json:"name"` // List of volumes to include in the PVM instance snapshot - VolumeIds []string `json:"volumeIDs"` + VolumeIDs []string `json:"volumeIDs"` } // Validate validates this snapshot create @@ -51,6 +53,11 @@ func (m *SnapshotCreate) validateName(formats strfmt.Registry) error { return nil } +// ContextValidate validates this snapshot create based on context it is used +func (m *SnapshotCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *SnapshotCreate) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/snapshot_create_response.go b/power/models/snapshot_create_response.go index c372430b..61214fb3 100644 --- a/power/models/snapshot_create_response.go +++ b/power/models/snapshot_create_response.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // SnapshotCreateResponse snapshot create response +// // swagger:model SnapshotCreateResponse type SnapshotCreateResponse struct { @@ -45,6 +47,11 @@ func (m *SnapshotCreateResponse) validateSnapshotID(formats strfmt.Registry) err return nil } +// ContextValidate validates this snapshot create response based on context it is used +func (m *SnapshotCreateResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *SnapshotCreateResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/snapshot_restore.go b/power/models/snapshot_restore.go index f9b8ba15..b2effe1f 100644 --- a/power/models/snapshot_restore.go +++ b/power/models/snapshot_restore.go @@ -6,12 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // SnapshotRestore snapshot restore +// // swagger:model SnapshotRestore type SnapshotRestore struct { @@ -24,6 +26,11 @@ func (m *SnapshotRestore) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this snapshot restore based on context it is used +func (m *SnapshotRestore) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *SnapshotRestore) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/snapshot_update.go b/power/models/snapshot_update.go index 27d6b775..162102e5 100644 --- a/power/models/snapshot_update.go +++ b/power/models/snapshot_update.go @@ -6,12 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // SnapshotUpdate snapshot update +// // swagger:model SnapshotUpdate type SnapshotUpdate struct { @@ -27,6 +29,11 @@ func (m *SnapshotUpdate) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this snapshot update based on context it is used +func (m *SnapshotUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *SnapshotUpdate) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/snapshots.go b/power/models/snapshots.go index 885d8eab..276c6119 100644 --- a/power/models/snapshots.go +++ b/power/models/snapshots.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Snapshots snapshots +// // swagger:model Snapshots type Snapshots struct { @@ -53,6 +54,42 @@ func (m *Snapshots) validateSnapshots(formats strfmt.Registry) error { if err := m.Snapshots[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("snapshots" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("snapshots" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this snapshots based on the context it is used +func (m *Snapshots) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateSnapshots(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Snapshots) contextValidateSnapshots(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Snapshots); i++ { + + if m.Snapshots[i] != nil { + if err := m.Snapshots[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("snapshots" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("snapshots" + "." + strconv.Itoa(i)) } return err } diff --git a/power/models/softlayer_subscription.go b/power/models/softlayer_subscription.go index c47a1216..26941f4f 100644 --- a/power/models/softlayer_subscription.go +++ b/power/models/softlayer_subscription.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // SoftlayerSubscription Softlayer subscription object +// // swagger:model SoftlayerSubscription type SoftlayerSubscription struct { @@ -62,6 +64,11 @@ func (m *SoftlayerSubscription) validateState(formats strfmt.Registry) error { return nil } +// ContextValidate validates this softlayer subscription based on context it is used +func (m *SoftlayerSubscription) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *SoftlayerSubscription) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/software_licenses.go b/power/models/software_licenses.go index d06fd08d..ae855dcc 100644 --- a/power/models/software_licenses.go +++ b/power/models/software_licenses.go @@ -6,12 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // SoftwareLicenses software licenses +// // swagger:model SoftwareLicenses type SoftwareLicenses struct { @@ -36,6 +38,11 @@ func (m *SoftwareLicenses) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this software licenses based on context it is used +func (m *SoftwareLicenses) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *SoftwareLicenses) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/ssh_key.go b/power/models/ssh_key.go index 29314e99..5112e6cd 100644 --- a/power/models/ssh_key.go +++ b/power/models/ssh_key.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // SSHKey SSH key +// // swagger:model SSHKey type SSHKey struct { @@ -53,7 +55,6 @@ func (m *SSHKey) Validate(formats strfmt.Registry) error { } func (m *SSHKey) validateCreationDate(formats strfmt.Registry) error { - if swag.IsZero(m.CreationDate) { // not required return nil } @@ -83,6 +84,11 @@ func (m *SSHKey) validateSSHKey(formats strfmt.Registry) error { return nil } +// ContextValidate validates this SSH key based on context it is used +func (m *SSHKey) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *SSHKey) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/ssh_keys.go b/power/models/ssh_keys.go index d281a24a..ae4e4cd5 100644 --- a/power/models/ssh_keys.go +++ b/power/models/ssh_keys.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // SSHKeys SSH keys +// // swagger:model SSHKeys type SSHKeys struct { @@ -53,6 +54,42 @@ func (m *SSHKeys) validateSSHKeys(formats strfmt.Registry) error { if err := m.SSHKeys[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("sshKeys" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sshKeys" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this SSH keys based on the context it is used +func (m *SSHKeys) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateSSHKeys(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SSHKeys) contextValidateSSHKeys(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.SSHKeys); i++ { + + if m.SSHKeys[i] != nil { + if err := m.SSHKeys[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sshKeys" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sshKeys" + "." + strconv.Itoa(i)) } return err } diff --git a/power/models/status.go b/power/models/status.go index 853fe116..b6221458 100644 --- a/power/models/status.go +++ b/power/models/status.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Status status +// // swagger:model Status type Status struct { @@ -65,6 +67,11 @@ func (m *Status) validateState(formats strfmt.Registry) error { return nil } +// ContextValidate validates this status based on context it is used +func (m *Status) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Status) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/stock_image.go b/power/models/stock_image.go index 61639996..5ec533e3 100644 --- a/power/models/stock_image.go +++ b/power/models/stock_image.go @@ -6,12 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // StockImage Stock image detail +// // swagger:model StockImage type StockImage struct { @@ -30,6 +32,11 @@ func (m *StockImage) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this stock image based on context it is used +func (m *StockImage) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *StockImage) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/stock_images.go b/power/models/stock_images.go index d9551dbe..8ad0b319 100644 --- a/power/models/stock_images.go +++ b/power/models/stock_images.go @@ -6,15 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // StockImages List of stock images +// // swagger:model StockImages type StockImages []*StockImage @@ -31,6 +32,33 @@ func (m StockImages) Validate(formats strfmt.Registry) error { if err := m[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName(strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validate this stock images based on the context it is used +func (m StockImages) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + + if m[i] != nil { + if err := m[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(strconv.Itoa(i)) } return err } diff --git a/power/models/storage_affinity.go b/power/models/storage_affinity.go index d63af261..071b9891 100644 --- a/power/models/storage_affinity.go +++ b/power/models/storage_affinity.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // StorageAffinity storage affinity +// // swagger:model StorageAffinity type StorageAffinity struct { @@ -67,20 +68,19 @@ const ( // StorageAffinityAffinityPolicyAffinity captures enum value "affinity" StorageAffinityAffinityPolicyAffinity string = "affinity" - // StorageAffinityAffinityPolicyAntiAffinity captures enum value "anti-affinity" - StorageAffinityAffinityPolicyAntiAffinity string = "anti-affinity" + // StorageAffinityAffinityPolicyAntiDashAffinity captures enum value "anti-affinity" + StorageAffinityAffinityPolicyAntiDashAffinity string = "anti-affinity" ) // prop value enum func (m *StorageAffinity) validateAffinityPolicyEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, storageAffinityTypeAffinityPolicyPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, storageAffinityTypeAffinityPolicyPropEnum, true); err != nil { return err } return nil } func (m *StorageAffinity) validateAffinityPolicy(formats strfmt.Registry) error { - if swag.IsZero(m.AffinityPolicy) { // not required return nil } @@ -93,6 +93,11 @@ func (m *StorageAffinity) validateAffinityPolicy(formats strfmt.Registry) error return nil } +// ContextValidate validates this storage affinity based on context it is used +func (m *StorageAffinity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *StorageAffinity) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/storage_entities.go b/power/models/storage_entities.go index fc22b2dd..5f8c6e8f 100644 --- a/power/models/storage_entities.go +++ b/power/models/storage_entities.go @@ -6,12 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // StorageEntities storage entities +// // swagger:model StorageEntities type StorageEntities struct { @@ -27,6 +29,11 @@ func (m *StorageEntities) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this storage entities based on context it is used +func (m *StorageEntities) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *StorageEntities) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/storage_pool.go b/power/models/storage_pool.go index 93a91996..ab18cac6 100644 --- a/power/models/storage_pool.go +++ b/power/models/storage_pool.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // StoragePool storage pool +// // swagger:model StoragePool type StoragePool struct { @@ -106,7 +107,6 @@ func (m *StoragePool) validateName(formats strfmt.Registry) error { } func (m *StoragePool) validateOverrideThresholds(formats strfmt.Registry) error { - if swag.IsZero(m.OverrideThresholds) { // not required return nil } @@ -115,6 +115,8 @@ func (m *StoragePool) validateOverrideThresholds(formats strfmt.Registry) error if err := m.OverrideThresholds.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("overrideThresholds") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("overrideThresholds") } return err } @@ -146,7 +148,7 @@ const ( // prop value enum func (m *StoragePool) validateStateEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, storagePoolTypeStatePropEnum); err != nil { + if err := validate.EnumCase(path, location, value, storagePoolTypeStatePropEnum, true); err != nil { return err } return nil @@ -175,6 +177,36 @@ func (m *StoragePool) validateType(formats strfmt.Registry) error { return nil } +// ContextValidate validate this storage pool based on the context it is used +func (m *StoragePool) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateOverrideThresholds(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *StoragePool) contextValidateOverrideThresholds(ctx context.Context, formats strfmt.Registry) error { + + if m.OverrideThresholds != nil { + if err := m.OverrideThresholds.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("overrideThresholds") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("overrideThresholds") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *StoragePool) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/storage_pool_capacity.go b/power/models/storage_pool_capacity.go index 4162d367..6b233d6b 100644 --- a/power/models/storage_pool_capacity.go +++ b/power/models/storage_pool_capacity.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // StoragePoolCapacity Storage pool capacity +// // swagger:model StoragePoolCapacity type StoragePoolCapacity struct { @@ -54,6 +56,11 @@ func (m *StoragePoolCapacity) validateMaxAllocationSize(formats strfmt.Registry) return nil } +// ContextValidate validates this storage pool capacity based on context it is used +func (m *StoragePoolCapacity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *StoragePoolCapacity) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/storage_pools.go b/power/models/storage_pools.go index 8cb5037e..622e1e19 100644 --- a/power/models/storage_pools.go +++ b/power/models/storage_pools.go @@ -6,15 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // StoragePools list of storage pools for a region-zone +// // swagger:model StoragePools type StoragePools []*StoragePool @@ -31,6 +32,33 @@ func (m StoragePools) Validate(formats strfmt.Registry) error { if err := m[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName(strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validate this storage pools based on the context it is used +func (m StoragePools) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + + if m[i] != nil { + if err := m[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(strconv.Itoa(i)) } return err } diff --git a/power/models/storage_pools_capacity.go b/power/models/storage_pools_capacity.go index 92380226..ad6c0465 100644 --- a/power/models/storage_pools_capacity.go +++ b/power/models/storage_pools_capacity.go @@ -6,15 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // StoragePoolsCapacity Storage capacity for all storage pools +// // swagger:model StoragePoolsCapacity type StoragePoolsCapacity struct { @@ -44,7 +45,6 @@ func (m *StoragePoolsCapacity) Validate(formats strfmt.Registry) error { } func (m *StoragePoolsCapacity) validateMaximumStorageAllocation(formats strfmt.Registry) error { - if swag.IsZero(m.MaximumStorageAllocation) { // not required return nil } @@ -53,6 +53,8 @@ func (m *StoragePoolsCapacity) validateMaximumStorageAllocation(formats strfmt.R if err := m.MaximumStorageAllocation.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("maximumStorageAllocation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("maximumStorageAllocation") } return err } @@ -62,7 +64,6 @@ func (m *StoragePoolsCapacity) validateMaximumStorageAllocation(formats strfmt.R } func (m *StoragePoolsCapacity) validateStoragePoolsCapacity(formats strfmt.Registry) error { - if swag.IsZero(m.StoragePoolsCapacity) { // not required return nil } @@ -76,6 +77,62 @@ func (m *StoragePoolsCapacity) validateStoragePoolsCapacity(formats strfmt.Regis if err := m.StoragePoolsCapacity[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("storagePoolsCapacity" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("storagePoolsCapacity" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this storage pools capacity based on the context it is used +func (m *StoragePoolsCapacity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMaximumStorageAllocation(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStoragePoolsCapacity(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *StoragePoolsCapacity) contextValidateMaximumStorageAllocation(ctx context.Context, formats strfmt.Registry) error { + + if m.MaximumStorageAllocation != nil { + if err := m.MaximumStorageAllocation.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("maximumStorageAllocation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("maximumStorageAllocation") + } + return err + } + } + + return nil +} + +func (m *StoragePoolsCapacity) contextValidateStoragePoolsCapacity(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.StoragePoolsCapacity); i++ { + + if m.StoragePoolsCapacity[i] != nil { + if err := m.StoragePoolsCapacity[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("storagePoolsCapacity" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("storagePoolsCapacity" + "." + strconv.Itoa(i)) } return err } diff --git a/power/models/storage_type.go b/power/models/storage_type.go index 1f709a93..4af1f895 100644 --- a/power/models/storage_type.go +++ b/power/models/storage_type.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // StorageType Storage type detail +// // swagger:model StorageType type StorageType struct { @@ -70,14 +71,13 @@ const ( // prop value enum func (m *StorageType) validateStateEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, storageTypeTypeStatePropEnum); err != nil { + if err := validate.EnumCase(path, location, value, storageTypeTypeStatePropEnum, true); err != nil { return err } return nil } func (m *StorageType) validateState(formats strfmt.Registry) error { - if swag.IsZero(m.State) { // not required return nil } @@ -90,6 +90,11 @@ func (m *StorageType) validateState(formats strfmt.Registry) error { return nil } +// ContextValidate validates this storage type based on context it is used +func (m *StorageType) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *StorageType) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/storage_type_capacity.go b/power/models/storage_type_capacity.go index 899d9d38..4ac3bf6d 100644 --- a/power/models/storage_type_capacity.go +++ b/power/models/storage_type_capacity.go @@ -6,15 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // StorageTypeCapacity Storage type capacity +// // swagger:model StorageTypeCapacity type StorageTypeCapacity struct { @@ -47,7 +48,6 @@ func (m *StorageTypeCapacity) Validate(formats strfmt.Registry) error { } func (m *StorageTypeCapacity) validateMaximumStorageAllocation(formats strfmt.Registry) error { - if swag.IsZero(m.MaximumStorageAllocation) { // not required return nil } @@ -56,6 +56,8 @@ func (m *StorageTypeCapacity) validateMaximumStorageAllocation(formats strfmt.Re if err := m.MaximumStorageAllocation.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("maximumStorageAllocation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("maximumStorageAllocation") } return err } @@ -65,7 +67,6 @@ func (m *StorageTypeCapacity) validateMaximumStorageAllocation(formats strfmt.Re } func (m *StorageTypeCapacity) validateStoragePoolsCapacity(formats strfmt.Registry) error { - if swag.IsZero(m.StoragePoolsCapacity) { // not required return nil } @@ -79,6 +80,62 @@ func (m *StorageTypeCapacity) validateStoragePoolsCapacity(formats strfmt.Regist if err := m.StoragePoolsCapacity[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("storagePoolsCapacity" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("storagePoolsCapacity" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this storage type capacity based on the context it is used +func (m *StorageTypeCapacity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMaximumStorageAllocation(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStoragePoolsCapacity(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *StorageTypeCapacity) contextValidateMaximumStorageAllocation(ctx context.Context, formats strfmt.Registry) error { + + if m.MaximumStorageAllocation != nil { + if err := m.MaximumStorageAllocation.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("maximumStorageAllocation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("maximumStorageAllocation") + } + return err + } + } + + return nil +} + +func (m *StorageTypeCapacity) contextValidateStoragePoolsCapacity(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.StoragePoolsCapacity); i++ { + + if m.StoragePoolsCapacity[i] != nil { + if err := m.StoragePoolsCapacity[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("storagePoolsCapacity" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("storagePoolsCapacity" + "." + strconv.Itoa(i)) } return err } diff --git a/power/models/storage_types.go b/power/models/storage_types.go index 3801a77a..d00c9cd4 100644 --- a/power/models/storage_types.go +++ b/power/models/storage_types.go @@ -6,13 +6,15 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/validate" ) // StorageTypes A map of an array of storage types supported in a region +// // swagger:model StorageTypes type StorageTypes map[string]RegionStorageTypes @@ -29,6 +31,31 @@ func (m StorageTypes) Validate(formats strfmt.Registry) error { if err := m[k].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName(k) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(k) + } + return err + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validate this storage types based on the context it is used +func (m StorageTypes) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + for k := range m { + + if err := m[k].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(k) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(k) } return err } diff --git a/power/models/storage_types_capacity.go b/power/models/storage_types_capacity.go index 79040673..de163af9 100644 --- a/power/models/storage_types_capacity.go +++ b/power/models/storage_types_capacity.go @@ -6,15 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // StorageTypesCapacity Storage types capacity +// // swagger:model StorageTypesCapacity type StorageTypesCapacity struct { @@ -44,7 +45,6 @@ func (m *StorageTypesCapacity) Validate(formats strfmt.Registry) error { } func (m *StorageTypesCapacity) validateMaximumStorageAllocation(formats strfmt.Registry) error { - if swag.IsZero(m.MaximumStorageAllocation) { // not required return nil } @@ -53,6 +53,8 @@ func (m *StorageTypesCapacity) validateMaximumStorageAllocation(formats strfmt.R if err := m.MaximumStorageAllocation.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("maximumStorageAllocation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("maximumStorageAllocation") } return err } @@ -62,7 +64,6 @@ func (m *StorageTypesCapacity) validateMaximumStorageAllocation(formats strfmt.R } func (m *StorageTypesCapacity) validateStorageTypesCapacity(formats strfmt.Registry) error { - if swag.IsZero(m.StorageTypesCapacity) { // not required return nil } @@ -76,6 +77,62 @@ func (m *StorageTypesCapacity) validateStorageTypesCapacity(formats strfmt.Regis if err := m.StorageTypesCapacity[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("storageTypesCapacity" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("storageTypesCapacity" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this storage types capacity based on the context it is used +func (m *StorageTypesCapacity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMaximumStorageAllocation(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStorageTypesCapacity(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *StorageTypesCapacity) contextValidateMaximumStorageAllocation(ctx context.Context, formats strfmt.Registry) error { + + if m.MaximumStorageAllocation != nil { + if err := m.MaximumStorageAllocation.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("maximumStorageAllocation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("maximumStorageAllocation") + } + return err + } + } + + return nil +} + +func (m *StorageTypesCapacity) contextValidateStorageTypesCapacity(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.StorageTypesCapacity); i++ { + + if m.StorageTypesCapacity[i] != nil { + if err := m.StorageTypesCapacity[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("storageTypesCapacity" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("storageTypesCapacity" + "." + strconv.Itoa(i)) } return err } diff --git a/power/models/system.go b/power/models/system.go index c1dc2c21..7e09b8ba 100644 --- a/power/models/system.go +++ b/power/models/system.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // System system +// // swagger:model System type System struct { @@ -65,6 +67,11 @@ func (m *System) validateMemory(formats strfmt.Registry) error { return nil } +// ContextValidate validates this system based on context it is used +func (m *System) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *System) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/system_pool.go b/power/models/system_pool.go index c9ae1311..59da690a 100644 --- a/power/models/system_pool.go +++ b/power/models/system_pool.go @@ -6,15 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // SystemPool Hardware platform detailing its limits and statistics +// // swagger:model SystemPool type SystemPool struct { @@ -78,7 +79,6 @@ func (m *SystemPool) Validate(formats strfmt.Registry) error { } func (m *SystemPool) validateCapacity(formats strfmt.Registry) error { - if swag.IsZero(m.Capacity) { // not required return nil } @@ -87,6 +87,8 @@ func (m *SystemPool) validateCapacity(formats strfmt.Registry) error { if err := m.Capacity.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("capacity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("capacity") } return err } @@ -96,7 +98,6 @@ func (m *SystemPool) validateCapacity(formats strfmt.Registry) error { } func (m *SystemPool) validateMaxAvailable(formats strfmt.Registry) error { - if swag.IsZero(m.MaxAvailable) { // not required return nil } @@ -105,6 +106,8 @@ func (m *SystemPool) validateMaxAvailable(formats strfmt.Registry) error { if err := m.MaxAvailable.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("maxAvailable") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("maxAvailable") } return err } @@ -114,7 +117,6 @@ func (m *SystemPool) validateMaxAvailable(formats strfmt.Registry) error { } func (m *SystemPool) validateMaxCoresAvailable(formats strfmt.Registry) error { - if swag.IsZero(m.MaxCoresAvailable) { // not required return nil } @@ -123,6 +125,8 @@ func (m *SystemPool) validateMaxCoresAvailable(formats strfmt.Registry) error { if err := m.MaxCoresAvailable.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("maxCoresAvailable") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("maxCoresAvailable") } return err } @@ -132,7 +136,6 @@ func (m *SystemPool) validateMaxCoresAvailable(formats strfmt.Registry) error { } func (m *SystemPool) validateMaxMemoryAvailable(formats strfmt.Registry) error { - if swag.IsZero(m.MaxMemoryAvailable) { // not required return nil } @@ -141,6 +144,8 @@ func (m *SystemPool) validateMaxMemoryAvailable(formats strfmt.Registry) error { if err := m.MaxMemoryAvailable.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("maxMemoryAvailable") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("maxMemoryAvailable") } return err } @@ -150,7 +155,6 @@ func (m *SystemPool) validateMaxMemoryAvailable(formats strfmt.Registry) error { } func (m *SystemPool) validateSharedCoreRatio(formats strfmt.Registry) error { - if swag.IsZero(m.SharedCoreRatio) { // not required return nil } @@ -159,6 +163,8 @@ func (m *SystemPool) validateSharedCoreRatio(formats strfmt.Registry) error { if err := m.SharedCoreRatio.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("sharedCoreRatio") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sharedCoreRatio") } return err } @@ -168,7 +174,6 @@ func (m *SystemPool) validateSharedCoreRatio(formats strfmt.Registry) error { } func (m *SystemPool) validateSystems(formats strfmt.Registry) error { - if swag.IsZero(m.Systems) { // not required return nil } @@ -182,6 +187,142 @@ func (m *SystemPool) validateSystems(formats strfmt.Registry) error { if err := m.Systems[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("systems" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("systems" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this system pool based on the context it is used +func (m *SystemPool) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCapacity(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMaxAvailable(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMaxCoresAvailable(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMaxMemoryAvailable(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSharedCoreRatio(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSystems(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SystemPool) contextValidateCapacity(ctx context.Context, formats strfmt.Registry) error { + + if m.Capacity != nil { + if err := m.Capacity.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("capacity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("capacity") + } + return err + } + } + + return nil +} + +func (m *SystemPool) contextValidateMaxAvailable(ctx context.Context, formats strfmt.Registry) error { + + if m.MaxAvailable != nil { + if err := m.MaxAvailable.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("maxAvailable") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("maxAvailable") + } + return err + } + } + + return nil +} + +func (m *SystemPool) contextValidateMaxCoresAvailable(ctx context.Context, formats strfmt.Registry) error { + + if m.MaxCoresAvailable != nil { + if err := m.MaxCoresAvailable.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("maxCoresAvailable") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("maxCoresAvailable") + } + return err + } + } + + return nil +} + +func (m *SystemPool) contextValidateMaxMemoryAvailable(ctx context.Context, formats strfmt.Registry) error { + + if m.MaxMemoryAvailable != nil { + if err := m.MaxMemoryAvailable.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("maxMemoryAvailable") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("maxMemoryAvailable") + } + return err + } + } + + return nil +} + +func (m *SystemPool) contextValidateSharedCoreRatio(ctx context.Context, formats strfmt.Registry) error { + + if m.SharedCoreRatio != nil { + if err := m.SharedCoreRatio.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sharedCoreRatio") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sharedCoreRatio") + } + return err + } + } + + return nil +} + +func (m *SystemPool) contextValidateSystems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Systems); i++ { + + if m.Systems[i] != nil { + if err := m.Systems[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("systems" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("systems" + "." + strconv.Itoa(i)) } return err } diff --git a/power/models/system_pools.go b/power/models/system_pools.go index c12cde48..b09c4b3a 100644 --- a/power/models/system_pools.go +++ b/power/models/system_pools.go @@ -6,13 +6,15 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/validate" ) // SystemPools List of available system pools within a particular DataCenter +// // swagger:model SystemPools type SystemPools map[string]SystemPool @@ -38,3 +40,23 @@ func (m SystemPools) Validate(formats strfmt.Registry) error { } return nil } + +// ContextValidate validate this system pools based on the context it is used +func (m SystemPools) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + for k := range m { + + if val, ok := m[k]; ok { + if err := val.ContextValidate(ctx, formats); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/models/task.go b/power/models/task.go index d5c4cf21..ccaf515a 100644 --- a/power/models/task.go +++ b/power/models/task.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Task task +// // swagger:model Task type Task struct { @@ -191,6 +193,11 @@ func (m *Task) validateTaskID(formats strfmt.Registry) error { return nil } +// ContextValidate validates this task based on context it is used +func (m *Task) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Task) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/task_reference.go b/power/models/task_reference.go index 0f7b85fc..aca4c6d2 100644 --- a/power/models/task_reference.go +++ b/power/models/task_reference.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // TaskReference task reference +// // swagger:model TaskReference type TaskReference struct { @@ -62,6 +64,11 @@ func (m *TaskReference) validateTaskID(formats strfmt.Registry) error { return nil } +// ContextValidate validates this task reference based on context it is used +func (m *TaskReference) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TaskReference) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/tenant.go b/power/models/tenant.go index df8acb6e..60dcec1b 100644 --- a/power/models/tenant.go +++ b/power/models/tenant.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Tenant tenant +// // swagger:model Tenant type Tenant struct { @@ -95,6 +96,8 @@ func (m *Tenant) validateCloudInstances(formats strfmt.Registry) error { if err := m.CloudInstances[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("cloudInstances" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("cloudInstances" + "." + strconv.Itoa(i)) } return err } @@ -128,7 +131,6 @@ func (m *Tenant) validateEnabled(formats strfmt.Registry) error { } func (m *Tenant) validatePeeringNetworks(formats strfmt.Registry) error { - if swag.IsZero(m.PeeringNetworks) { // not required return nil } @@ -142,6 +144,8 @@ func (m *Tenant) validatePeeringNetworks(formats strfmt.Registry) error { if err := m.PeeringNetworks[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("peeringNetworks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("peeringNetworks" + "." + strconv.Itoa(i)) } return err } @@ -153,7 +157,6 @@ func (m *Tenant) validatePeeringNetworks(formats strfmt.Registry) error { } func (m *Tenant) validateSSHKeys(formats strfmt.Registry) error { - if swag.IsZero(m.SSHKeys) { // not required return nil } @@ -167,6 +170,8 @@ func (m *Tenant) validateSSHKeys(formats strfmt.Registry) error { if err := m.SSHKeys[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("sshKeys" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sshKeys" + "." + strconv.Itoa(i)) } return err } @@ -186,6 +191,88 @@ func (m *Tenant) validateTenantID(formats strfmt.Registry) error { return nil } +// ContextValidate validate this tenant based on the context it is used +func (m *Tenant) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCloudInstances(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePeeringNetworks(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSSHKeys(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Tenant) contextValidateCloudInstances(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.CloudInstances); i++ { + + if m.CloudInstances[i] != nil { + if err := m.CloudInstances[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cloudInstances" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("cloudInstances" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Tenant) contextValidatePeeringNetworks(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.PeeringNetworks); i++ { + + if m.PeeringNetworks[i] != nil { + if err := m.PeeringNetworks[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("peeringNetworks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("peeringNetworks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Tenant) contextValidateSSHKeys(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.SSHKeys); i++ { + + if m.SSHKeys[i] != nil { + if err := m.SSHKeys[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sshKeys" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sshKeys" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *Tenant) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/tenant_update.go b/power/models/tenant_update.go index 25edd294..a1a9e439 100644 --- a/power/models/tenant_update.go +++ b/power/models/tenant_update.go @@ -6,15 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // TenantUpdate tenant update +// // swagger:model TenantUpdate type TenantUpdate struct { @@ -40,7 +41,6 @@ func (m *TenantUpdate) Validate(formats strfmt.Registry) error { } func (m *TenantUpdate) validatePeeringNetworks(formats strfmt.Registry) error { - if swag.IsZero(m.PeeringNetworks) { // not required return nil } @@ -54,6 +54,42 @@ func (m *TenantUpdate) validatePeeringNetworks(formats strfmt.Registry) error { if err := m.PeeringNetworks[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("peeringNetworks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("peeringNetworks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this tenant update based on the context it is used +func (m *TenantUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePeeringNetworks(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TenantUpdate) contextValidatePeeringNetworks(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.PeeringNetworks); i++ { + + if m.PeeringNetworks[i] != nil { + if err := m.PeeringNetworks[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("peeringNetworks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("peeringNetworks" + "." + strconv.Itoa(i)) } return err } diff --git a/power/models/thresholds.go b/power/models/thresholds.go index 93ec80bc..9d142d57 100644 --- a/power/models/thresholds.go +++ b/power/models/thresholds.go @@ -6,13 +6,15 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // Thresholds storage threshold settings +// // swagger:model Thresholds type Thresholds struct { @@ -63,7 +65,6 @@ func (m *Thresholds) Validate(formats strfmt.Registry) error { } func (m *Thresholds) validateCapacity(formats strfmt.Registry) error { - if swag.IsZero(m.Capacity) { // not required return nil } @@ -72,6 +73,8 @@ func (m *Thresholds) validateCapacity(formats strfmt.Registry) error { if err := m.Capacity.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("capacity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("capacity") } return err } @@ -81,7 +84,6 @@ func (m *Thresholds) validateCapacity(formats strfmt.Registry) error { } func (m *Thresholds) validateOvercommit(formats strfmt.Registry) error { - if swag.IsZero(m.Overcommit) { // not required return nil } @@ -90,6 +92,8 @@ func (m *Thresholds) validateOvercommit(formats strfmt.Registry) error { if err := m.Overcommit.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("overcommit") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("overcommit") } return err } @@ -99,7 +103,6 @@ func (m *Thresholds) validateOvercommit(formats strfmt.Registry) error { } func (m *Thresholds) validatePhysicalCapacity(formats strfmt.Registry) error { - if swag.IsZero(m.PhysicalCapacity) { // not required return nil } @@ -108,6 +111,8 @@ func (m *Thresholds) validatePhysicalCapacity(formats strfmt.Registry) error { if err := m.PhysicalCapacity.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("physicalCapacity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("physicalCapacity") } return err } @@ -117,7 +122,6 @@ func (m *Thresholds) validatePhysicalCapacity(formats strfmt.Registry) error { } func (m *Thresholds) validateVdiskCapacity(formats strfmt.Registry) error { - if swag.IsZero(m.VdiskCapacity) { // not required return nil } @@ -126,6 +130,8 @@ func (m *Thresholds) validateVdiskCapacity(formats strfmt.Registry) error { if err := m.VdiskCapacity.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("vdiskCapacity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vdiskCapacity") } return err } @@ -135,7 +141,6 @@ func (m *Thresholds) validateVdiskCapacity(formats strfmt.Registry) error { } func (m *Thresholds) validateVdiskLimit(formats strfmt.Registry) error { - if swag.IsZero(m.VdiskLimit) { // not required return nil } @@ -144,6 +149,118 @@ func (m *Thresholds) validateVdiskLimit(formats strfmt.Registry) error { if err := m.VdiskLimit.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("vdiskLimit") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vdiskLimit") + } + return err + } + } + + return nil +} + +// ContextValidate validate this thresholds based on the context it is used +func (m *Thresholds) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCapacity(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateOvercommit(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePhysicalCapacity(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateVdiskCapacity(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateVdiskLimit(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Thresholds) contextValidateCapacity(ctx context.Context, formats strfmt.Registry) error { + + if m.Capacity != nil { + if err := m.Capacity.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("capacity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("capacity") + } + return err + } + } + + return nil +} + +func (m *Thresholds) contextValidateOvercommit(ctx context.Context, formats strfmt.Registry) error { + + if m.Overcommit != nil { + if err := m.Overcommit.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("overcommit") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("overcommit") + } + return err + } + } + + return nil +} + +func (m *Thresholds) contextValidatePhysicalCapacity(ctx context.Context, formats strfmt.Registry) error { + + if m.PhysicalCapacity != nil { + if err := m.PhysicalCapacity.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("physicalCapacity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("physicalCapacity") + } + return err + } + } + + return nil +} + +func (m *Thresholds) contextValidateVdiskCapacity(ctx context.Context, formats strfmt.Registry) error { + + if m.VdiskCapacity != nil { + if err := m.VdiskCapacity.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vdiskCapacity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vdiskCapacity") + } + return err + } + } + + return nil +} + +func (m *Thresholds) contextValidateVdiskLimit(ctx context.Context, formats strfmt.Registry) error { + + if m.VdiskLimit != nil { + if err := m.VdiskLimit.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vdiskLimit") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vdiskLimit") } return err } diff --git a/power/models/token.go b/power/models/token.go index 70fe73bc..7dcf3634 100644 --- a/power/models/token.go +++ b/power/models/token.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Token token +// // swagger:model Token type Token struct { @@ -101,6 +103,11 @@ func (m *Token) validateType(formats strfmt.Registry) error { return nil } +// ContextValidate validates this token based on context it is used +func (m *Token) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Token) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/token_extra.go b/power/models/token_extra.go index d8f6b64f..a37a8bc2 100644 --- a/power/models/token_extra.go +++ b/power/models/token_extra.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // TokenExtra token extra +// // swagger:model TokenExtra type TokenExtra struct { @@ -93,6 +95,8 @@ func (m *TokenExtra) validateToken(formats strfmt.Registry) error { if err := m.Token.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("token") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("token") } return err } @@ -110,6 +114,36 @@ func (m *TokenExtra) validateValid(formats strfmt.Registry) error { return nil } +// ContextValidate validate this token extra based on the context it is used +func (m *TokenExtra) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateToken(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TokenExtra) contextValidateToken(ctx context.Context, formats strfmt.Registry) error { + + if m.Token != nil { + if err := m.Token.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("token") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("token") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TokenExtra) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/token_request.go b/power/models/token_request.go index e622f512..a136c5ce 100644 --- a/power/models/token_request.go +++ b/power/models/token_request.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // TokenRequest token request +// // swagger:model TokenRequest type TokenRequest struct { @@ -79,7 +80,7 @@ const ( // prop value enum func (m *TokenRequest) validateSourceEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, tokenRequestTypeSourcePropEnum); err != nil { + if err := validate.EnumCase(path, location, value, tokenRequestTypeSourcePropEnum, true); err != nil { return err } return nil @@ -99,6 +100,11 @@ func (m *TokenRequest) validateSource(formats strfmt.Registry) error { return nil } +// ContextValidate validates this token request based on context it is used +func (m *TokenRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TokenRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/update_storage_pool.go b/power/models/update_storage_pool.go index 2c90d0c9..b186a57b 100644 --- a/power/models/update_storage_pool.go +++ b/power/models/update_storage_pool.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // UpdateStoragePool update storage pool +// // swagger:model UpdateStoragePool type UpdateStoragePool struct { @@ -52,7 +53,6 @@ func (m *UpdateStoragePool) Validate(formats strfmt.Registry) error { } func (m *UpdateStoragePool) validateOverrideThresholds(formats strfmt.Registry) error { - if swag.IsZero(m.OverrideThresholds) { // not required return nil } @@ -61,6 +61,8 @@ func (m *UpdateStoragePool) validateOverrideThresholds(formats strfmt.Registry) if err := m.OverrideThresholds.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("overrideThresholds") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("overrideThresholds") } return err } @@ -92,14 +94,13 @@ const ( // prop value enum func (m *UpdateStoragePool) validateStateEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, updateStoragePoolTypeStatePropEnum); err != nil { + if err := validate.EnumCase(path, location, value, updateStoragePoolTypeStatePropEnum, true); err != nil { return err } return nil } func (m *UpdateStoragePool) validateState(formats strfmt.Registry) error { - if swag.IsZero(m.State) { // not required return nil } @@ -112,6 +113,36 @@ func (m *UpdateStoragePool) validateState(formats strfmt.Registry) error { return nil } +// ContextValidate validate this update storage pool based on the context it is used +func (m *UpdateStoragePool) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateOverrideThresholds(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UpdateStoragePool) contextValidateOverrideThresholds(ctx context.Context, formats strfmt.Registry) error { + + if m.OverrideThresholds != nil { + if err := m.OverrideThresholds.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("overrideThresholds") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("overrideThresholds") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *UpdateStoragePool) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/update_volume.go b/power/models/update_volume.go index ab44cd60..630668b1 100644 --- a/power/models/update_volume.go +++ b/power/models/update_volume.go @@ -6,12 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // UpdateVolume update volume +// // swagger:model UpdateVolume type UpdateVolume struct { @@ -33,6 +35,11 @@ func (m *UpdateVolume) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this update volume based on context it is used +func (m *UpdateVolume) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *UpdateVolume) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/user_info.go b/power/models/user_info.go index d343271d..95978214 100644 --- a/power/models/user_info.go +++ b/power/models/user_info.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // UserInfo user info +// // swagger:model UserInfo type UserInfo struct { @@ -85,6 +87,11 @@ func (m *UserInfo) validateName(formats strfmt.Registry) error { return nil } +// ContextValidate validates this user info based on context it is used +func (m *UserInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *UserInfo) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/v_p_n_connection.go b/power/models/v_p_n_connection.go index b6a07e61..368b9814 100644 --- a/power/models/v_p_n_connection.go +++ b/power/models/v_p_n_connection.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // VPNConnection v p n connection +// // swagger:model VPNConnection type VPNConnection struct { @@ -24,6 +25,7 @@ type VPNConnection struct { DeadPeerDetection *DeadPeerDetection `json:"deadPeerDetection"` // unique identifier for VPN Connection + // Example: 123e4567-e89b-12d3-a456-42661475 // Required: true ID *string `json:"id"` @@ -36,28 +38,32 @@ type VPNConnection struct { IPSecPolicy *IPSecPolicyRef `json:"ipSecPolicy"` // local Gateway address, only in 'route' mode. + // Example: 192.168.1.1 // Required: true LocalGatewayAddress *string `json:"localGatewayAddress"` // Mode used by this VPNConnection, either policy-based, or route-based, this attribute is set at the creation and cannot be updated later. + // Example: policy // Required: true // Enum: [policy route] Mode *string `json:"mode"` // VPN Connection name + // Example: VPN-Connection-1 // Required: true Name *string `json:"name"` // an array of network IDs // Required: true - NetworkIds []string `json:"networkIDs"` + NetworkIDs []string `json:"networkIDs"` // peer gateway address // Required: true // Format: ipv4 - PeerGatewayAddress PeerGatewayAddress `json:"peerGatewayAddress"` + PeerGatewayAddress *PeerGatewayAddress `json:"peerGatewayAddress"` // an array of strings containing CIDR of peer subnets + // Example: ["128.170.1.0/20","128.169.1.0/24","128.168.1.0/27","128.170.1.0/32"] // Required: true PeerSubnets []string `json:"peerSubnets"` @@ -67,6 +73,7 @@ type VPNConnection struct { Status *string `json:"status"` // public IP address of the VPN Gateway (vSRX) attached to this VPNConnection + // Example: 192.168.204.1 // Required: true VpnGatewayAddress *string `json:"vpnGatewayAddress"` } @@ -103,7 +110,7 @@ func (m *VPNConnection) Validate(formats strfmt.Registry) error { res = append(res, err) } - if err := m.validateNetworkIds(formats); err != nil { + if err := m.validateNetworkIDs(formats); err != nil { res = append(res, err) } @@ -139,6 +146,8 @@ func (m *VPNConnection) validateDeadPeerDetection(formats strfmt.Registry) error if err := m.DeadPeerDetection.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("deadPeerDetection") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("deadPeerDetection") } return err } @@ -166,6 +175,8 @@ func (m *VPNConnection) validateIkePolicy(formats strfmt.Registry) error { if err := m.IkePolicy.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("ikePolicy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ikePolicy") } return err } @@ -184,6 +195,8 @@ func (m *VPNConnection) validateIPSecPolicy(formats strfmt.Registry) error { if err := m.IPSecPolicy.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("ipSecPolicy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipSecPolicy") } return err } @@ -224,7 +237,7 @@ const ( // prop value enum func (m *VPNConnection) validateModeEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, vPNConnectionTypeModePropEnum); err != nil { + if err := validate.EnumCase(path, location, value, vPNConnectionTypeModePropEnum, true); err != nil { return err } return nil @@ -253,9 +266,9 @@ func (m *VPNConnection) validateName(formats strfmt.Registry) error { return nil } -func (m *VPNConnection) validateNetworkIds(formats strfmt.Registry) error { +func (m *VPNConnection) validateNetworkIDs(formats strfmt.Registry) error { - if err := validate.Required("networkIDs", "body", m.NetworkIds); err != nil { + if err := validate.Required("networkIDs", "body", m.NetworkIDs); err != nil { return err } @@ -264,13 +277,25 @@ func (m *VPNConnection) validateNetworkIds(formats strfmt.Registry) error { func (m *VPNConnection) validatePeerGatewayAddress(formats strfmt.Registry) error { - if err := m.PeerGatewayAddress.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("peerGatewayAddress") - } + if err := validate.Required("peerGatewayAddress", "body", m.PeerGatewayAddress); err != nil { + return err + } + + if err := validate.Required("peerGatewayAddress", "body", m.PeerGatewayAddress); err != nil { return err } + if m.PeerGatewayAddress != nil { + if err := m.PeerGatewayAddress.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("peerGatewayAddress") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("peerGatewayAddress") + } + return err + } + } + return nil } @@ -309,7 +334,7 @@ const ( // prop value enum func (m *VPNConnection) validateStatusEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, vPNConnectionTypeStatusPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, vPNConnectionTypeStatusPropEnum, true); err != nil { return err } return nil @@ -338,6 +363,96 @@ func (m *VPNConnection) validateVpnGatewayAddress(formats strfmt.Registry) error return nil } +// ContextValidate validate this v p n connection based on the context it is used +func (m *VPNConnection) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDeadPeerDetection(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateIkePolicy(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateIPSecPolicy(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePeerGatewayAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VPNConnection) contextValidateDeadPeerDetection(ctx context.Context, formats strfmt.Registry) error { + + if m.DeadPeerDetection != nil { + if err := m.DeadPeerDetection.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("deadPeerDetection") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("deadPeerDetection") + } + return err + } + } + + return nil +} + +func (m *VPNConnection) contextValidateIkePolicy(ctx context.Context, formats strfmt.Registry) error { + + if m.IkePolicy != nil { + if err := m.IkePolicy.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ikePolicy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ikePolicy") + } + return err + } + } + + return nil +} + +func (m *VPNConnection) contextValidateIPSecPolicy(ctx context.Context, formats strfmt.Registry) error { + + if m.IPSecPolicy != nil { + if err := m.IPSecPolicy.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ipSecPolicy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipSecPolicy") + } + return err + } + } + + return nil +} + +func (m *VPNConnection) contextValidatePeerGatewayAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.PeerGatewayAddress != nil { + if err := m.PeerGatewayAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("peerGatewayAddress") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("peerGatewayAddress") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *VPNConnection) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/v_p_n_connection_create.go b/power/models/v_p_n_connection_create.go index aa97f550..a98a8db4 100644 --- a/power/models/v_p_n_connection_create.go +++ b/power/models/v_p_n_connection_create.go @@ -6,46 +6,53 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // VPNConnectionCreate v p n connection create +// // swagger:model VPNConnectionCreate type VPNConnectionCreate struct { // unique identifier of IKEPolicy selected for this VPNConnection + // Example: c36723ec-8593-11eb-8dcd-0242ac133853 // Required: true IkePolicy *string `json:"ikePolicy"` // unique identifier of IPSecPolicy selected for this VPNConnection + // Example: c12345d-8593-11eb-8dcd-0242ac134573 // Required: true IPSecPolicy *string `json:"ipSecPolicy"` // Mode used by this VPNConnection, either policy-based, or route-based, this attribute is set at the creation and cannot be updated later. + // Example: policy // Required: true // Enum: [policy route] Mode *string `json:"mode"` // VPN Connection name + // Example: VPN-Connection-1 // Required: true Name *string `json:"name"` // an array of network IDs to attach to this VPNConnection + // Example: ["7f950c76-8582-11veb-8dcd-0242ac153","7f950c76-8582-11veb-8dcd-0242ac144","7f950c76-8582-11veb-8dcd-0242ac199"] // Required: true Networks []string `json:"networks"` // peer gateway address // Required: true // Format: ipv4 - PeerGatewayAddress PeerGatewayAddress `json:"peerGatewayAddress"` + PeerGatewayAddress *PeerGatewayAddress `json:"peerGatewayAddress"` // an array of strings containing CIDR of peer subnets + // Example: ["128.170.1.0/20","128.169.1.0/24","128.168.1.0/27","128.170.1.0/32"] // Required: true PeerSubnets []string `json:"peerSubnets"` } @@ -129,7 +136,7 @@ const ( // prop value enum func (m *VPNConnectionCreate) validateModeEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, vPNConnectionCreateTypeModePropEnum); err != nil { + if err := validate.EnumCase(path, location, value, vPNConnectionCreateTypeModePropEnum, true); err != nil { return err } return nil @@ -169,13 +176,25 @@ func (m *VPNConnectionCreate) validateNetworks(formats strfmt.Registry) error { func (m *VPNConnectionCreate) validatePeerGatewayAddress(formats strfmt.Registry) error { - if err := m.PeerGatewayAddress.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("peerGatewayAddress") - } + if err := validate.Required("peerGatewayAddress", "body", m.PeerGatewayAddress); err != nil { return err } + if err := validate.Required("peerGatewayAddress", "body", m.PeerGatewayAddress); err != nil { + return err + } + + if m.PeerGatewayAddress != nil { + if err := m.PeerGatewayAddress.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("peerGatewayAddress") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("peerGatewayAddress") + } + return err + } + } + return nil } @@ -188,6 +207,36 @@ func (m *VPNConnectionCreate) validatePeerSubnets(formats strfmt.Registry) error return nil } +// ContextValidate validate this v p n connection create based on the context it is used +func (m *VPNConnectionCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePeerGatewayAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VPNConnectionCreate) contextValidatePeerGatewayAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.PeerGatewayAddress != nil { + if err := m.PeerGatewayAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("peerGatewayAddress") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("peerGatewayAddress") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *VPNConnectionCreate) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/v_p_n_connection_create_response.go b/power/models/v_p_n_connection_create_response.go index 6b1f05d6..fc9c60ef 100644 --- a/power/models/v_p_n_connection_create_response.go +++ b/power/models/v_p_n_connection_create_response.go @@ -6,13 +6,15 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // VPNConnectionCreateResponse v p n connection create response +// // swagger:model VPNConnectionCreateResponse type VPNConnectionCreateResponse struct { VPNConnection @@ -86,7 +88,6 @@ func (m *VPNConnectionCreateResponse) Validate(formats strfmt.Registry) error { } func (m *VPNConnectionCreateResponse) validateJobRef(formats strfmt.Registry) error { - if swag.IsZero(m.JobRef) { // not required return nil } @@ -95,6 +96,43 @@ func (m *VPNConnectionCreateResponse) validateJobRef(formats strfmt.Registry) er if err := m.JobRef.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("jobRef") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("jobRef") + } + return err + } + } + + return nil +} + +// ContextValidate validate this v p n connection create response based on the context it is used +func (m *VPNConnectionCreateResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with VPNConnection + if err := m.VPNConnection.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateJobRef(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VPNConnectionCreateResponse) contextValidateJobRef(ctx context.Context, formats strfmt.Registry) error { + + if m.JobRef != nil { + if err := m.JobRef.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("jobRef") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("jobRef") } return err } diff --git a/power/models/v_p_n_connection_update.go b/power/models/v_p_n_connection_update.go index 3e25f99a..a771e5c2 100644 --- a/power/models/v_p_n_connection_update.go +++ b/power/models/v_p_n_connection_update.go @@ -6,25 +6,31 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // VPNConnectionUpdate VPN Connection object to send during the update +// +// Min Properties: 1 +// // swagger:model VPNConnectionUpdate type VPNConnectionUpdate struct { // unique identifier of IKEPolicy selected for this VPNConnection + // Example: c36723ec-8593-11eb-8dcd-0242ac133853 IkePolicy string `json:"ikePolicy,omitempty"` // unique identifier of IPSecPolicy selected for this VPNConnection + // Example: c12345d-8593-11eb-8dcd-0242ac134573 IPSecPolicy string `json:"ipSecPolicy,omitempty"` // VPN Connection name + // Example: VPN-Connection-1 Name string `json:"name,omitempty"` // peer gateway address @@ -41,12 +47,15 @@ func (m *VPNConnectionUpdate) UnmarshalJSON(data []byte) error { var stage1 struct { // unique identifier of IKEPolicy selected for this VPNConnection + // Example: c36723ec-8593-11eb-8dcd-0242ac133853 IkePolicy string `json:"ikePolicy,omitempty"` // unique identifier of IPSecPolicy selected for this VPNConnection + // Example: c12345d-8593-11eb-8dcd-0242ac134573 IPSecPolicy string `json:"ipSecPolicy,omitempty"` // VPN Connection name + // Example: VPN-Connection-1 Name string `json:"name,omitempty"` // peer gateway address @@ -59,13 +68,9 @@ func (m *VPNConnectionUpdate) UnmarshalJSON(data []byte) error { var rcv VPNConnectionUpdate rcv.IkePolicy = stage1.IkePolicy - rcv.IPSecPolicy = stage1.IPSecPolicy - rcv.Name = stage1.Name - rcv.PeerGatewayAddress = stage1.PeerGatewayAddress - *m = rcv // stage 2, remove properties and add to map @@ -75,13 +80,9 @@ func (m *VPNConnectionUpdate) UnmarshalJSON(data []byte) error { } delete(stage2, "ikePolicy") - delete(stage2, "ipSecPolicy") - delete(stage2, "name") - delete(stage2, "peerGatewayAddress") - // stage 3, add additional properties values if len(stage2) > 0 { result := make(map[string]interface{}) @@ -103,12 +104,15 @@ func (m VPNConnectionUpdate) MarshalJSON() ([]byte, error) { var stage1 struct { // unique identifier of IKEPolicy selected for this VPNConnection + // Example: c36723ec-8593-11eb-8dcd-0242ac133853 IkePolicy string `json:"ikePolicy,omitempty"` // unique identifier of IPSecPolicy selected for this VPNConnection + // Example: c12345d-8593-11eb-8dcd-0242ac134573 IPSecPolicy string `json:"ipSecPolicy,omitempty"` // VPN Connection name + // Example: VPN-Connection-1 Name string `json:"name,omitempty"` // peer gateway address @@ -117,11 +121,8 @@ func (m VPNConnectionUpdate) MarshalJSON() ([]byte, error) { } stage1.IkePolicy = m.IkePolicy - stage1.IPSecPolicy = m.IPSecPolicy - stage1.Name = m.Name - stage1.PeerGatewayAddress = m.PeerGatewayAddress // make JSON object for known properties @@ -130,7 +131,7 @@ func (m VPNConnectionUpdate) MarshalJSON() ([]byte, error) { return nil, err } - if len(m.VPNConnectionUpdateAdditionalProperties) == 0 { + if len(m.VPNConnectionUpdateAdditionalProperties) == 0 { // no additional properties return props, nil } @@ -140,19 +141,40 @@ func (m VPNConnectionUpdate) MarshalJSON() ([]byte, error) { return nil, err } - if len(props) < 3 { + if len(props) < 3 { // "{}": only additional properties return additional, nil } // concatenate the 2 objects - props[len(props)-1] = ',' - return append(props, additional[1:]...), nil + return swag.ConcatJSON(props, additional), nil } // Validate validates this v p n connection update func (m *VPNConnectionUpdate) Validate(formats strfmt.Registry) error { var res []error + // short circuits minProperties > 0 + if m == nil { + return errors.TooFewProperties("", "body", 1) + } + + props := make(map[string]json.RawMessage, 4+10) + j, err := swag.WriteJSON(m) + if err != nil { + return err + } + + if err = swag.ReadJSON(j, &props); err != nil { + return err + } + + nprops := len(props) + + // minProperties: 1 + if nprops < 1 { + return errors.TooFewProperties("", "body", 1) + } + if err := m.validatePeerGatewayAddress(formats); err != nil { res = append(res, err) } @@ -164,7 +186,6 @@ func (m *VPNConnectionUpdate) Validate(formats strfmt.Registry) error { } func (m *VPNConnectionUpdate) validatePeerGatewayAddress(formats strfmt.Registry) error { - if swag.IsZero(m.PeerGatewayAddress) { // not required return nil } @@ -172,6 +193,36 @@ func (m *VPNConnectionUpdate) validatePeerGatewayAddress(formats strfmt.Registry if err := m.PeerGatewayAddress.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("peerGatewayAddress") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("peerGatewayAddress") + } + return err + } + + return nil +} + +// ContextValidate validate this v p n connection update based on the context it is used +func (m *VPNConnectionUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePeerGatewayAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VPNConnectionUpdate) contextValidatePeerGatewayAddress(ctx context.Context, formats strfmt.Registry) error { + + if err := m.PeerGatewayAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("peerGatewayAddress") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("peerGatewayAddress") } return err } diff --git a/power/models/v_p_n_connections.go b/power/models/v_p_n_connections.go index 7d62f338..789c3657 100644 --- a/power/models/v_p_n_connections.go +++ b/power/models/v_p_n_connections.go @@ -6,19 +6,21 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // VPNConnections v p n connections +// // swagger:model VPNConnections type VPNConnections struct { // an array of VPN Connections + // Example: [{"deadPeerDetection":{"action":"restart","interval":10,"threshold":5},"id":"123e4567-e89b-12d3-a456-42661475","ikePolicy":{"id":"7654e321-e89b-12d3-a456-4566447","name":"IKE Policy 3"},"ipSecPolicy":{"id":"456f7890-e89b-12d3-a456-4569934","name":"IPSec Policy 2"},"localGatewayAddress":"192.168.1.1","mode":"route","name":"VPN Connection 2","peerGatewayAddress":"192.168.44.1","peerSubnets":["128.169.1.0/24","128.168.1.0/27"],"status":"Active","vpnGatewayAddress":"192.168.24.1"}] VpnConnections []*VPNConnection `json:"vpnConnections"` } @@ -37,7 +39,6 @@ func (m *VPNConnections) Validate(formats strfmt.Registry) error { } func (m *VPNConnections) validateVpnConnections(formats strfmt.Registry) error { - if swag.IsZero(m.VpnConnections) { // not required return nil } @@ -51,6 +52,42 @@ func (m *VPNConnections) validateVpnConnections(formats strfmt.Registry) error { if err := m.VpnConnections[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("vpnConnections" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vpnConnections" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this v p n connections based on the context it is used +func (m *VPNConnections) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateVpnConnections(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VPNConnections) contextValidateVpnConnections(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.VpnConnections); i++ { + + if m.VpnConnections[i] != nil { + if err := m.VpnConnections[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vpnConnections" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vpnConnections" + "." + strconv.Itoa(i)) } return err } diff --git a/power/models/v_p_naa_s_options.go b/power/models/v_p_naa_s_options.go index b47ad9a1..ca802f90 100644 --- a/power/models/v_p_naa_s_options.go +++ b/power/models/v_p_naa_s_options.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // VPNaaSOptions v p naa s options +// // swagger:model VPNaaSOptions type VPNaaSOptions struct { @@ -78,6 +80,8 @@ func (m *VPNaaSOptions) validateDeadPeerDetection(formats strfmt.Registry) error if err := m.DeadPeerDetection.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("deadPeerDetection") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("deadPeerDetection") } return err } @@ -96,6 +100,8 @@ func (m *VPNaaSOptions) validateIkePolicyOptions(formats strfmt.Registry) error if err := m.IkePolicyOptions.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("ikePolicyOptions") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ikePolicyOptions") } return err } @@ -114,6 +120,8 @@ func (m *VPNaaSOptions) validateIkePolicyTemplate(formats strfmt.Registry) error if err := m.IkePolicyTemplate.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("ikePolicyTemplate") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ikePolicyTemplate") } return err } @@ -132,6 +140,8 @@ func (m *VPNaaSOptions) validateIPSecPolicyOptions(formats strfmt.Registry) erro if err := m.IPSecPolicyOptions.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("ipSecPolicyOptions") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipSecPolicyOptions") } return err } @@ -150,6 +160,118 @@ func (m *VPNaaSOptions) validateIPSecPolicyTemplate(formats strfmt.Registry) err if err := m.IPSecPolicyTemplate.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("ipSecPolicyTemplate") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipSecPolicyTemplate") + } + return err + } + } + + return nil +} + +// ContextValidate validate this v p naa s options based on the context it is used +func (m *VPNaaSOptions) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDeadPeerDetection(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateIkePolicyOptions(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateIkePolicyTemplate(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateIPSecPolicyOptions(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateIPSecPolicyTemplate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VPNaaSOptions) contextValidateDeadPeerDetection(ctx context.Context, formats strfmt.Registry) error { + + if m.DeadPeerDetection != nil { + if err := m.DeadPeerDetection.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("deadPeerDetection") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("deadPeerDetection") + } + return err + } + } + + return nil +} + +func (m *VPNaaSOptions) contextValidateIkePolicyOptions(ctx context.Context, formats strfmt.Registry) error { + + if m.IkePolicyOptions != nil { + if err := m.IkePolicyOptions.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ikePolicyOptions") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ikePolicyOptions") + } + return err + } + } + + return nil +} + +func (m *VPNaaSOptions) contextValidateIkePolicyTemplate(ctx context.Context, formats strfmt.Registry) error { + + if m.IkePolicyTemplate != nil { + if err := m.IkePolicyTemplate.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ikePolicyTemplate") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ikePolicyTemplate") + } + return err + } + } + + return nil +} + +func (m *VPNaaSOptions) contextValidateIPSecPolicyOptions(ctx context.Context, formats strfmt.Registry) error { + + if m.IPSecPolicyOptions != nil { + if err := m.IPSecPolicyOptions.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ipSecPolicyOptions") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipSecPolicyOptions") + } + return err + } + } + + return nil +} + +func (m *VPNaaSOptions) contextValidateIPSecPolicyTemplate(ctx context.Context, formats strfmt.Registry) error { + + if m.IPSecPolicyTemplate != nil { + if err := m.IPSecPolicyTemplate.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ipSecPolicyTemplate") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipSecPolicyTemplate") } return err } diff --git a/power/models/version.go b/power/models/version.go index 0d57619e..8432df23 100644 --- a/power/models/version.go +++ b/power/models/version.go @@ -6,12 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // Version version +// // swagger:model Version type Version struct { @@ -33,6 +35,11 @@ func (m *Version) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this version based on context it is used +func (m *Version) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Version) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/virtual_cores.go b/power/models/virtual_cores.go index 7ce4fc20..5d133078 100644 --- a/power/models/virtual_cores.go +++ b/power/models/virtual_cores.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // VirtualCores virtual cores +// // swagger:model VirtualCores type VirtualCores struct { @@ -49,13 +51,18 @@ func (m *VirtualCores) validateAssigned(formats strfmt.Registry) error { return err } - if err := validate.MinimumInt("assigned", "body", int64(*m.Assigned), 1, false); err != nil { + if err := validate.MinimumInt("assigned", "body", *m.Assigned, 1, false); err != nil { return err } return nil } +// ContextValidate validates this virtual cores based on context it is used +func (m *VirtualCores) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *VirtualCores) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/volume.go b/power/models/volume.go index 7ad36612..167869c3 100644 --- a/power/models/volume.go +++ b/power/models/volume.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Volume volume +// // swagger:model Volume type Volume struct { @@ -53,7 +55,7 @@ type Volume struct { Name *string `json:"name"` // List of PCloud PVM Instance attached to the volume - PvmInstanceIds []string `json:"pvmInstanceIDs"` + PvmInstanceIDs []string `json:"pvmInstanceIDs"` // shows the replication status of a volume ReplicationStatus string `json:"replicationStatus,omitempty"` @@ -165,6 +167,11 @@ func (m *Volume) validateVolumeID(formats strfmt.Registry) error { return nil } +// ContextValidate validates this volume based on context it is used +func (m *Volume) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Volume) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/volume_action.go b/power/models/volume_action.go index 79ebba9f..b0c8b5eb 100644 --- a/power/models/volume_action.go +++ b/power/models/volume_action.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // VolumeAction volume action +// // swagger:model VolumeAction type VolumeAction struct { @@ -45,6 +47,11 @@ func (m *VolumeAction) validateReplicationEnabled(formats strfmt.Registry) error return nil } +// ContextValidate validates this volume action based on context it is used +func (m *VolumeAction) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *VolumeAction) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/volume_info.go b/power/models/volume_info.go index b339b5fe..26f5b3f2 100644 --- a/power/models/volume_info.go +++ b/power/models/volume_info.go @@ -6,12 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // VolumeInfo volume info +// // swagger:model VolumeInfo type VolumeInfo struct { @@ -27,6 +29,11 @@ func (m *VolumeInfo) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this volume info based on context it is used +func (m *VolumeInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *VolumeInfo) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/volume_reference.go b/power/models/volume_reference.go index b99e32d0..95783127 100644 --- a/power/models/volume_reference.go +++ b/power/models/volume_reference.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // VolumeReference volume reference +// // swagger:model VolumeReference type VolumeReference struct { @@ -59,7 +61,7 @@ type VolumeReference struct { Name *string `json:"name"` // List of PCloud PVM Instance attached to the volume - PvmInstanceIds []string `json:"pvmInstanceIDs"` + PvmInstanceIDs []string `json:"pvmInstanceIDs"` // shows the replication status of a volume ReplicationStatus string `json:"replicationStatus,omitempty"` @@ -252,6 +254,11 @@ func (m *VolumeReference) validateWwn(formats strfmt.Registry) error { return nil } +// ContextValidate validates this volume reference based on context it is used +func (m *VolumeReference) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *VolumeReference) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/volumes.go b/power/models/volumes.go index 477c6d34..b701d483 100644 --- a/power/models/volumes.go +++ b/power/models/volumes.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Volumes volumes +// // swagger:model Volumes type Volumes struct { @@ -53,6 +54,42 @@ func (m *Volumes) validateVolumes(formats strfmt.Registry) error { if err := m.Volumes[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("volumes" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("volumes" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this volumes based on the context it is used +func (m *Volumes) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateVolumes(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Volumes) contextValidateVolumes(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Volumes); i++ { + + if m.Volumes[i] != nil { + if err := m.Volumes[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("volumes" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("volumes" + "." + strconv.Itoa(i)) } return err } diff --git a/power/models/volumes_attach.go b/power/models/volumes_attach.go index 1c8c8a3e..5e5b69b0 100644 --- a/power/models/volumes_attach.go +++ b/power/models/volumes_attach.go @@ -6,27 +6,29 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // VolumesAttach volumes attach +// // swagger:model volumesAttach type VolumesAttach struct { // List of volumes to be attached to a PVM instance // Required: true - VolumeIds []string `json:"volumeIDs"` + VolumeIDs []string `json:"volumeIDs"` } // Validate validates this volumes attach func (m *VolumesAttach) Validate(formats strfmt.Registry) error { var res []error - if err := m.validateVolumeIds(formats); err != nil { + if err := m.validateVolumeIDs(formats); err != nil { res = append(res, err) } @@ -36,15 +38,20 @@ func (m *VolumesAttach) Validate(formats strfmt.Registry) error { return nil } -func (m *VolumesAttach) validateVolumeIds(formats strfmt.Registry) error { +func (m *VolumesAttach) validateVolumeIDs(formats strfmt.Registry) error { - if err := validate.Required("volumeIDs", "body", m.VolumeIds); err != nil { + if err := validate.Required("volumeIDs", "body", m.VolumeIDs); err != nil { return err } return nil } +// ContextValidate validates this volumes attach based on context it is used +func (m *VolumesAttach) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *VolumesAttach) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/volumes_attachment_response.go b/power/models/volumes_attachment_response.go index 985fe4c5..a8d453d2 100644 --- a/power/models/volumes_attachment_response.go +++ b/power/models/volumes_attachment_response.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // VolumesAttachmentResponse volumes attachment response +// // swagger:model VolumesAttachmentResponse type VolumesAttachmentResponse struct { @@ -45,6 +47,11 @@ func (m *VolumesAttachmentResponse) validateSummary(formats strfmt.Registry) err return nil } +// ContextValidate validates this volumes attachment response based on context it is used +func (m *VolumesAttachmentResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *VolumesAttachmentResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/volumes_clone.go b/power/models/volumes_clone.go index 5a57acef..38cd8e67 100644 --- a/power/models/volumes_clone.go +++ b/power/models/volumes_clone.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // VolumesClone volumes clone +// // swagger:model VolumesClone type VolumesClone struct { @@ -68,7 +70,6 @@ func (m *VolumesClone) Validate(formats strfmt.Registry) error { } func (m *VolumesClone) validateCreationDate(formats strfmt.Registry) error { - if swag.IsZero(m.CreationDate) { // not required return nil } @@ -81,7 +82,6 @@ func (m *VolumesClone) validateCreationDate(formats strfmt.Registry) error { } func (m *VolumesClone) validateLastUpdateDate(formats strfmt.Registry) error { - if swag.IsZero(m.LastUpdateDate) { // not required return nil } @@ -102,6 +102,11 @@ func (m *VolumesClone) validatePercentComplete(formats strfmt.Registry) error { return nil } +// ContextValidate validates this volumes clone based on context it is used +func (m *VolumesClone) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *VolumesClone) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/volumes_clone_async_request.go b/power/models/volumes_clone_async_request.go index d6feeeca..4ec6f73c 100644 --- a/power/models/volumes_clone_async_request.go +++ b/power/models/volumes_clone_async_request.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // VolumesCloneAsyncRequest volumes clone async request +// // swagger:model VolumesCloneAsyncRequest type VolumesCloneAsyncRequest struct { @@ -30,7 +32,7 @@ type VolumesCloneAsyncRequest struct { // List of volumes to be cloned // Required: true - VolumeIds []string `json:"volumeIDs"` + VolumeIDs []string `json:"volumeIDs"` } // Validate validates this volumes clone async request @@ -41,7 +43,7 @@ func (m *VolumesCloneAsyncRequest) Validate(formats strfmt.Registry) error { res = append(res, err) } - if err := m.validateVolumeIds(formats); err != nil { + if err := m.validateVolumeIDs(formats); err != nil { res = append(res, err) } @@ -60,15 +62,20 @@ func (m *VolumesCloneAsyncRequest) validateName(formats strfmt.Registry) error { return nil } -func (m *VolumesCloneAsyncRequest) validateVolumeIds(formats strfmt.Registry) error { +func (m *VolumesCloneAsyncRequest) validateVolumeIDs(formats strfmt.Registry) error { - if err := validate.Required("volumeIDs", "body", m.VolumeIds); err != nil { + if err := validate.Required("volumeIDs", "body", m.VolumeIDs); err != nil { return err } return nil } +// ContextValidate validates this volumes clone async request based on context it is used +func (m *VolumesCloneAsyncRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *VolumesCloneAsyncRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/volumes_clone_cancel.go b/power/models/volumes_clone_cancel.go index b7247a07..44bf4c72 100644 --- a/power/models/volumes_clone_cancel.go +++ b/power/models/volumes_clone_cancel.go @@ -6,12 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // VolumesCloneCancel volumes clone cancel +// // swagger:model VolumesCloneCancel type VolumesCloneCancel struct { @@ -26,6 +28,11 @@ func (m *VolumesCloneCancel) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this volumes clone cancel based on context it is used +func (m *VolumesCloneCancel) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *VolumesCloneCancel) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/volumes_clone_create.go b/power/models/volumes_clone_create.go index 64183ff1..77b38ab9 100644 --- a/power/models/volumes_clone_create.go +++ b/power/models/volumes_clone_create.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // VolumesCloneCreate volumes clone create +// // swagger:model VolumesCloneCreate type VolumesCloneCreate struct { @@ -25,7 +27,7 @@ type VolumesCloneCreate struct { // List of volumes to be cloned // Required: true - VolumeIds []string `json:"volumeIDs"` + VolumeIDs []string `json:"volumeIDs"` } // Validate validates this volumes clone create @@ -36,7 +38,7 @@ func (m *VolumesCloneCreate) Validate(formats strfmt.Registry) error { res = append(res, err) } - if err := m.validateVolumeIds(formats); err != nil { + if err := m.validateVolumeIDs(formats); err != nil { res = append(res, err) } @@ -55,15 +57,20 @@ func (m *VolumesCloneCreate) validateName(formats strfmt.Registry) error { return nil } -func (m *VolumesCloneCreate) validateVolumeIds(formats strfmt.Registry) error { +func (m *VolumesCloneCreate) validateVolumeIDs(formats strfmt.Registry) error { - if err := validate.Required("volumeIDs", "body", m.VolumeIds); err != nil { + if err := validate.Required("volumeIDs", "body", m.VolumeIDs); err != nil { return err } return nil } +// ContextValidate validates this volumes clone create based on context it is used +func (m *VolumesCloneCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *VolumesCloneCreate) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/volumes_clone_detail.go b/power/models/volumes_clone_detail.go index 3e45cc24..24a51c91 100644 --- a/power/models/volumes_clone_detail.go +++ b/power/models/volumes_clone_detail.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // VolumesCloneDetail volumes clone detail +// // swagger:model VolumesCloneDetail type VolumesCloneDetail struct { @@ -77,7 +78,6 @@ func (m *VolumesCloneDetail) Validate(formats strfmt.Registry) error { } func (m *VolumesCloneDetail) validateClonedVolumes(formats strfmt.Registry) error { - if swag.IsZero(m.ClonedVolumes) { // not required return nil } @@ -91,6 +91,8 @@ func (m *VolumesCloneDetail) validateClonedVolumes(formats strfmt.Registry) erro if err := m.ClonedVolumes[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("clonedVolumes" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("clonedVolumes" + "." + strconv.Itoa(i)) } return err } @@ -102,7 +104,6 @@ func (m *VolumesCloneDetail) validateClonedVolumes(formats strfmt.Registry) erro } func (m *VolumesCloneDetail) validateCreationDate(formats strfmt.Registry) error { - if swag.IsZero(m.CreationDate) { // not required return nil } @@ -115,7 +116,6 @@ func (m *VolumesCloneDetail) validateCreationDate(formats strfmt.Registry) error } func (m *VolumesCloneDetail) validateLastUpdateDate(formats strfmt.Registry) error { - if swag.IsZero(m.LastUpdateDate) { // not required return nil } @@ -136,6 +136,40 @@ func (m *VolumesCloneDetail) validatePercentComplete(formats strfmt.Registry) er return nil } +// ContextValidate validate this volumes clone detail based on the context it is used +func (m *VolumesCloneDetail) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateClonedVolumes(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VolumesCloneDetail) contextValidateClonedVolumes(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.ClonedVolumes); i++ { + + if m.ClonedVolumes[i] != nil { + if err := m.ClonedVolumes[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("clonedVolumes" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("clonedVolumes" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *VolumesCloneDetail) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/volumes_clone_execute.go b/power/models/volumes_clone_execute.go index ff610c70..1e10ae5d 100644 --- a/power/models/volumes_clone_execute.go +++ b/power/models/volumes_clone_execute.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // VolumesCloneExecute volumes clone execute +// // swagger:model VolumesCloneExecute type VolumesCloneExecute struct { @@ -57,6 +59,11 @@ func (m *VolumesCloneExecute) validateName(formats strfmt.Registry) error { return nil } +// ContextValidate validates this volumes clone execute based on context it is used +func (m *VolumesCloneExecute) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *VolumesCloneExecute) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/volumes_clone_request.go b/power/models/volumes_clone_request.go index 2a4e7c3e..7ed5f8c5 100644 --- a/power/models/volumes_clone_request.go +++ b/power/models/volumes_clone_request.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // VolumesCloneRequest volumes clone request +// // swagger:model VolumesCloneRequest type VolumesCloneRequest struct { @@ -29,7 +31,7 @@ type VolumesCloneRequest struct { // List of volumes to be cloned // Required: true - VolumeIds []string `json:"volumeIDs"` + VolumeIDs []string `json:"volumeIDs"` } // Validate validates this volumes clone request @@ -40,7 +42,7 @@ func (m *VolumesCloneRequest) Validate(formats strfmt.Registry) error { res = append(res, err) } - if err := m.validateVolumeIds(formats); err != nil { + if err := m.validateVolumeIDs(formats); err != nil { res = append(res, err) } @@ -59,15 +61,20 @@ func (m *VolumesCloneRequest) validateDisplayName(formats strfmt.Registry) error return nil } -func (m *VolumesCloneRequest) validateVolumeIds(formats strfmt.Registry) error { +func (m *VolumesCloneRequest) validateVolumeIDs(formats strfmt.Registry) error { - if err := validate.Required("volumeIDs", "body", m.VolumeIds); err != nil { + if err := validate.Required("volumeIDs", "body", m.VolumeIDs); err != nil { return err } return nil } +// ContextValidate validates this volumes clone request based on context it is used +func (m *VolumesCloneRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *VolumesCloneRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/volumes_clone_response.go b/power/models/volumes_clone_response.go index 96a2aad1..09ecf72c 100644 --- a/power/models/volumes_clone_response.go +++ b/power/models/volumes_clone_response.go @@ -6,12 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // VolumesCloneResponse volumes clone response +// // swagger:model VolumesCloneResponse type VolumesCloneResponse struct { @@ -27,6 +29,11 @@ func (m *VolumesCloneResponse) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this volumes clone response based on context it is used +func (m *VolumesCloneResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *VolumesCloneResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/volumes_clones.go b/power/models/volumes_clones.go index 3aa4aa23..33bcab36 100644 --- a/power/models/volumes_clones.go +++ b/power/models/volumes_clones.go @@ -6,15 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // VolumesClones volumes clones +// // swagger:model VolumesClones type VolumesClones struct { @@ -37,7 +38,6 @@ func (m *VolumesClones) Validate(formats strfmt.Registry) error { } func (m *VolumesClones) validateVolumesClone(formats strfmt.Registry) error { - if swag.IsZero(m.VolumesClone) { // not required return nil } @@ -51,6 +51,42 @@ func (m *VolumesClones) validateVolumesClone(formats strfmt.Registry) error { if err := m.VolumesClone[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("volumesClone" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("volumesClone" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this volumes clones based on the context it is used +func (m *VolumesClones) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateVolumesClone(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VolumesClones) contextValidateVolumesClone(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.VolumesClone); i++ { + + if m.VolumesClone[i] != nil { + if err := m.VolumesClone[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("volumesClone" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("volumesClone" + "." + strconv.Itoa(i)) } return err } diff --git a/utils/utils.go b/utils/utils.go deleted file mode 100644 index d42a0700..00000000 --- a/utils/utils.go +++ /dev/null @@ -1,62 +0,0 @@ -package utils - -import ( - "net/url" - "os" - "reflect" - - "github.com/IBM-Cloud/power-go-client/helpers" -) - -// GetNext ... -func GetNext(next interface{}) string { - if reflect.ValueOf(next).IsNil() { - return "" - } - - u, err := url.Parse(reflect.ValueOf(next).Elem().FieldByName("Href").Elem().String()) - if err != nil { - return "" - } - - q := u.Query() - return q.Get("start") -} - -// GetEndpoint ... -func GetEndpoint(generation int, regionName string) string { - - switch generation { - case 1: - ep := getGCEndpoint(regionName) - return helpers.EnvFallBack([]string{"IBMCLOUD_IS_API_ENDPOINT"}, ep) - case 2: - ep := getNGEndpoint(regionName) - return helpers.EnvFallBack([]string{"IBMCLOUD_IS_NG_API_ENDPOINT"}, ep) - } - ep := getNGEndpoint(regionName) - return helpers.EnvFallBack([]string{"IBMCLOUD_IS_NG_API_ENDPOINT"}, ep) -} - -func getGCEndpoint(regionName string) string { - if url := os.Getenv("IBMCLOUD_IS_API_ENDPOINT"); url != "" { - return url - } - return regionName + ".iaas.cloud.ibm.com" -} - -// For Power-IAAS -func getNGEndpoint(regionName string) string { - if url := os.Getenv("IBMCLOUD_IS_NG_API_ENDPOINT"); url != "" { - return url - } - return regionName + ".power-iaas.cloud.ibm.com" -} - -func GetPowerEndPoint(regionName string) string { - if url := os.Getenv("IBMCLOUD_POWER_API_ENDPOINT"); url != "" { - return url - } - return regionName + ".power-iaas.cloud.ibm.com" - -}